added a troubleshooting link in case of out-of-memory errors
parent
d7d91269ec
commit
9f5efc3091
|
@ -56,6 +56,8 @@ class Application extends BaseApplication
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
static $shutdownRegistered = false;
|
||||||
|
|
||||||
if (function_exists('ini_set') && extension_loaded('xdebug')) {
|
if (function_exists('ini_set') && extension_loaded('xdebug')) {
|
||||||
ini_set('xdebug.show_exception_trace', false);
|
ini_set('xdebug.show_exception_trace', false);
|
||||||
ini_set('xdebug.scream', false);
|
ini_set('xdebug.scream', false);
|
||||||
|
@ -64,6 +66,20 @@ class Application extends BaseApplication
|
||||||
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
|
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$shutdownRegistered) {
|
||||||
|
$shutdownRegistered = true;
|
||||||
|
|
||||||
|
register_shutdown_function(function() {
|
||||||
|
$lastError = error_get_last();
|
||||||
|
|
||||||
|
if ($lastError && $lastError['message'] &&
|
||||||
|
(strpos($lastError['message'], 'Allowed memory') !== false /*Zend PHP out of memory error*/ ||
|
||||||
|
strpos($lastError['message'], 'exceeded memory') !== false /*HHVM out of memory errors*/)) {
|
||||||
|
echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct('Composer', Composer::VERSION);
|
parent::__construct('Composer', Composer::VERSION);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue