Stupid sexy error_get_last

This commit is contained in:
fbsanchez 2021-07-22 11:41:04 +02:00
parent d3270904bd
commit dc7d30cbf8

View File

@ -1340,19 +1340,16 @@ class Client
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
set_error_handler( set_error_handler(
function ($errno, $errstr) { function ($errno, $errstr) {
if (preg_match('/Undefined index/i', $errstr) > 0) {
return;
}
throw new \Exception($errstr, $errno); throw new \Exception($errstr, $errno);
} },
E_ERROR
); );
register_shutdown_function( register_shutdown_function(
function () { function () {
$error = error_get_last(); $error = error_get_last();
if (null !== $error if (null !== $error
&& preg_match('/Undefined index/i', $error['message']) !== 1 && $error['type'] === E_ERROR
) { ) {
echo __('Failed to analyze package: %s', $error['message']); echo __('Failed to analyze package: %s', $error['message']);
} }
@ -1435,12 +1432,9 @@ class Client
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
set_error_handler( set_error_handler(
function ($errno, $errstr) { function ($errno, $errstr) {
if (preg_match('/Undefined index/i', $errstr) > 0) {
return;
}
throw new \Exception($errstr, $errno); throw new \Exception($errstr, $errno);
} },
E_ERROR
); );
if ($package === null) { if ($package === null) {