wordpress-website-lifecycle/mu-plugins/_core-php-bug-50921.php
2023-04-10 00:59:13 +00:00

22 lines
491 B
PHP

<?php
/*
* Plugin Name: Fix PHP bug #50921: '200 OK' HTTP status despite PHP error
* Plugin URI: https://bugs.php.net/bug.php?id=50921
*/
add_action(
'shutdown',
static function () {
// display_errors needs to be disabled.
if ('1' === ini_get('display_errors')) {
return;
}
$error = error_get_last();
if (E_ERROR === $error['type']) {
header('HTTP/1.1 500 Internal Server Error');
}
},
0,
0
);