Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/RemoteLRS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down