Stupid sexy error_get_last

This commit is contained in:
fbsanchez 2021-07-22 11:41:04 +02:00
parent d3270904bd
commit dc7d30cbf8
1 changed files with 5 additions and 11 deletions

View File

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