Skip to content

Commit 5b13a71

Browse files
westonruterdmsnell
andcommitted
Account for display_errors being stderr
Co-authored-by: Dennis Snell <[email protected]>
1 parent cc31d80 commit 5b13a71

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wp-includes/template.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,8 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
987987
return false;
988988
}
989989
);
990-
$display_errors = ini_get( 'display_errors' );
991-
if ( $display_errors ) {
990+
$original_display_errors = ini_get( 'display_errors' );
991+
if ( $original_display_errors ) {
992992
ini_set( 'display_errors', 0 );
993993
}
994994

@@ -1071,7 +1071,7 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
10711071
}
10721072

10731073
// Append any errors to be displayed before returning flushing the buffer.
1074-
if ( $display_errors ) {
1074+
if ( $original_display_errors && 'stderr' !== $original_display_errors ) {
10751075
foreach ( $error_log as $error ) {
10761076
switch ( $error['level'] ) {
10771077
case E_USER_NOTICE:
@@ -1100,7 +1100,7 @@ static function ( int $level, string $message, ?string $file = null, ?int $line
11001100
$filtered_output .= sprintf( $format, ini_get( 'error_prepend_string' ), $type, $error['message'], $error['file'], $error['line'], ini_get( 'error_append_string' ) );
11011101
}
11021102

1103-
ini_set( 'display_errors', 1 );
1103+
ini_set( 'display_errors', $original_display_errors );
11041104
}
11051105

11061106
restore_error_handler();

0 commit comments

Comments
 (0)