mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2026-07-27 02:55:34 +08:00
22 lines
511 B
PHP
22 lines
511 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 (is_array($error) && $error['type'] === E_ERROR) {
|
|
header('HTTP/1.1 500 Internal Server Error');
|
|
}
|
|
},
|
|
0,
|
|
0
|
|
);
|