Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
* @subpackage Administration
*/

// Confidence check.
if ( false ) {
?>
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
Expand All @@ -20,8 +18,7 @@
<p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
</body>
</html>
<?php
}
<?php

/**
* We are installing WordPress.
Expand Down
18 changes: 10 additions & 8 deletions src/wp-includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1033,18 +1033,19 @@ function wp_finalize_template_enhancement_output_buffer( string $output, int $ph

$filtered_output = $output;

$did_just_catch = false;
$handler_state = (object) array(
'did_just_catch' => false,
);

$error_log = array();
set_error_handler(
static function ( int $level, string $message, ?string $file = null, ?int $line = null ) use ( &$error_log, &$did_just_catch ) {
static function ( int $level, string $message, ?string $file = null, ?int $line = null ) use ( &$error_log, &$handler_state ) {
// Switch a user error to an exception so that it can be caught and the buffer can be returned.
if ( E_USER_ERROR === $level ) {
throw new Exception( __( 'User error triggered:' ) . ' ' . $message );
}

// Display a caught exception as an error since it prevents any of the output buffer filters from applying.
if ( $did_just_catch ) {
if ( $handler_state->did_just_catch ) {
$level = E_USER_ERROR;
}

Expand Down Expand Up @@ -1087,7 +1088,7 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
$filtered_output = (string) apply_filters( 'wp_template_enhancement_output_buffer', $filtered_output, $output );
} catch ( Throwable $throwable ) {
// Emit to the error log as a warning not as an error to prevent halting execution.
$did_just_catch = true;
$handler_state->did_just_catch = true;
trigger_error(
sprintf(
/* translators: %s is the throwable class name */
Expand All @@ -1096,7 +1097,8 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
) . ' ' . $throwable->getMessage(),
E_USER_WARNING
);
$did_just_catch = false;
$handler_state->did_just_catch = false;

}

try {
Expand Down Expand Up @@ -1126,7 +1128,7 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
do_action( 'wp_finalized_template_enhancement_output_buffer', $filtered_output );
} catch ( Throwable $throwable ) {
// Emit to the error log as a warning not as an error to prevent halting execution.
$did_just_catch = true;
$handler_state->did_just_catch = true;
trigger_error(
sprintf(
/* translators: %s is the class name */
Expand All @@ -1135,7 +1137,7 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
) . ' ' . $throwable->getMessage(),
E_USER_WARNING
);
$did_just_catch = false;
$handler_state->did_just_catch = false;
}

// Append any errors to be displayed before returning flushing the buffer.
Expand Down
4 changes: 1 addition & 3 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,7 @@ function login_footer( $input_id = '' ) {
wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
?>

<?php if ( $interim_login ) { ?>
<input type="hidden" name="interim-login" value="1" />
<?php } ?>
<input type="hidden" name="interim-login" value="1" />

<?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?>
<input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" />
Expand Down
15 changes: 0 additions & 15 deletions tests/phpstan/baselines/if.alwaysFalse.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

parameters:
ignoreErrors:
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../../src/wp-admin/install.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
Expand All @@ -33,13 +28,3 @@ parameters:
identifier: if.alwaysFalse
count: 1
path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../../src/wp-includes/template.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
count: 1
path: ../../../src/wp-login.php
Loading