#12087 Fixed report with fatal error
This commit is contained in:
parent
9e4903e545
commit
a842c8249f
|
@ -149,6 +149,26 @@ function reporting_get_name($id_report)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees memory in case of fatal error.
|
||||||
|
*
|
||||||
|
* @param mixed $memory Object that reserves memory.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function shutdown($memory)
|
||||||
|
{
|
||||||
|
// Unsetting $memory does not free up memory.
|
||||||
|
// I also tried unsetting a global variable which did not free up the memory.
|
||||||
|
unset($memory->reserve);
|
||||||
|
|
||||||
|
$error = error_get_last();
|
||||||
|
if (isset($error['type']) === true && $error['type'] === 1) {
|
||||||
|
echo __('You have no memory for this operation, increase the memory limit.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function reporting_make_reporting_data(
|
function reporting_make_reporting_data(
|
||||||
$report,
|
$report,
|
||||||
$id_report,
|
$id_report,
|
||||||
|
@ -170,6 +190,11 @@ function reporting_make_reporting_data(
|
||||||
|
|
||||||
enterprise_include_once('include/functions_metaconsole.php');
|
enterprise_include_once('include/functions_metaconsole.php');
|
||||||
|
|
||||||
|
$memory = new stdClass();
|
||||||
|
// Reserve 3 mega bytes.
|
||||||
|
$memory->reserve = str_repeat('*', (1024 * 1024));
|
||||||
|
register_shutdown_function('shutdown', $memory);
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
if (!empty($report)) {
|
if (!empty($report)) {
|
||||||
$contents = io_safe_output($report['contents']);
|
$contents = io_safe_output($report['contents']);
|
||||||
|
|
Loading…
Reference in New Issue