diff --git a/src/wp-admin/install.php b/src/wp-admin/install.php index 3d5a142b482dd..4a839877cc8b1 100644 --- a/src/wp-admin/install.php +++ b/src/wp-admin/install.php @@ -6,9 +6,7 @@ * @subpackage Administration */ -// Confidence check. -if ( false ) { - ?> +?> @@ -20,8 +18,7 @@

WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.

- 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; } @@ -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 */ @@ -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 { @@ -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 */ @@ -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. diff --git a/src/wp-login.php b/src/wp-login.php index 43689323647de..d49991954f61b 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -402,9 +402,7 @@ function login_footer( $input_id = '' ) { wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) ); ?> - - - + diff --git a/tests/phpstan/baselines/if.alwaysFalse.neon b/tests/phpstan/baselines/if.alwaysFalse.neon index 6e33ed2a5365c..ed5648f9d7f5e 100644 --- a/tests/phpstan/baselines/if.alwaysFalse.neon +++ b/tests/phpstan/baselines/if.alwaysFalse.neon @@ -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 @@ -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