diff --git a/src/RemoteLRS.php b/src/RemoteLRS.php index 5a354c3..0d47559 100644 --- a/src/RemoteLRS.php +++ b/src/RemoteLRS.php @@ -137,7 +137,7 @@ protected function sendRequest($method, $resource) { // normal handling // set_error_handler( - function ($errno, $errstr, $errfile, $errline, array $errcontext) { + function ($errno, $errstr, $errfile, $errline) { // "!== false" is intentional. strpos() can return 0, which is falsey, but returning // 0 matches our "true" condition. Using strict equality to avoid that confusion. if ($errno == E_NOTICE && strpos($errstr, 'Array to string conversion') !== false) { @@ -162,7 +162,13 @@ function ($errno, $errstr, $errfile, $errline, array $errcontext) { $fp = fopen($url, 'rb', false, $context); if (! $fp) { - $content = "Request failed: $php_errormsg"; + $content = "Request failed"; + + $last_error = error_get_last(); + + if($last_error && $last_error['type'] === E_ERROR) { + $content .= ": " . $last_error['message']; + } } } catch (\ErrorException $ex) {