[wp-trac] [WordPress Trac] #57876: class WP_Fatal_Error_Handler can not handle memory limit errors
WordPress Trac
noreply at wordpress.org
Sat Mar 11 11:55:30 UTC 2023
#57876: class WP_Fatal_Error_Handler can not handle memory limit errors
----------------------------+------------------------------
Reporter: amisiewicz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bootstrap/Load | Version: trunk
Severity: minor | Resolution:
Keywords: close | Focuses: performance
----------------------------+------------------------------
Changes (by amisiewicz):
* keywords: dev-feedback => close
Comment:
I couldn't find any information on that topic. I just tested it out
manually with this simple script:
{{{#!php
<?php
// Set the memory limit to a low value for testing purposes
ini_set('memory_limit', '5M');
// Disable error display
ini_set('display_errors', 'Off');
// Define the shutdown function
function shutdown_function() {
$error = error_get_last();
// still works in php5.6
$some_more_memory = range(1, 2000);
// do not work in php5.6
// $some_more_memory = range(1, 3000);
// still works in php7.4 and php8.1
// $some_more_memory = range(1, 60000);
// do not work in php7.4 and php8.1
// $some_more_memory = range(1, 70000);
if ($error !== null) {
$message = "The script has been shut down due to an error:
{$error['message']}\n";
}
echo $message;
}
// Register the shutdown function
register_shutdown_function('shutdown_function');
// Allocate an array that exceeds the memory limit
$large_array = range(1, 1000000);
}}}
My conclusion is that this is not a problem. We can still assign some
variables (less memory to assign in php5.6, more in php7 and above), but
php can still do it. I'm not sure why the monolog library does what it
does.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57876#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list