We are using this SDK with PHP 8.5 and getting deprecation warnings during autoloading.
The problem is in src/OneflowSDK.php in the request() method:
// line ~283
if ($response === false) throw new Exception("Problem reading data from $url, $php_errormsg");
// line ~285
preg_match('{HTTP\/\S*\s(\d{3})}', $http_response_header[0], $match);
$php_errormsg was removed in PHP 8.0. $http_response_header is deprecated in PHP 8.5.
The fix for both:
// replace $php_errormsg with:
$lastError = error_get_last();
throw new Exception("Problem reading data from $url, " . ($lastError['message'] ?? ''));
// replace $http_response_header with:
$meta = stream_get_meta_data($fp);
preg_match('{HTTP\/\S*\s(\d{3})}', $meta['wrapper_data'][0], $match);
Also ini_set("track_errors", "on") at the top of that method can be removed, it was removed in PHP 8.0 as well.
Are you still maintaining this package? Happy to open a PR with the fix if useful.
We are using this SDK with
PHP 8.5and getting deprecation warnings during autoloading.The problem is in
src/OneflowSDK.phpin the request() method:$php_errormsgwas removed in PHP 8.0.$http_response_headeris deprecated in PHP 8.5.The fix for both:
Also ini_set("track_errors", "on") at the top of that method can be removed, it was removed in PHP 8.0 as well.
Are you still maintaining this package? Happy to open a PR with the fix if useful.