You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the process of upgrading php from 7.1 to 7.4 for the app using this library and it looks like 7.4 is a bit more strict with certain things and is causing the following code (line 2) to throw an exception "Trying to access array offset on value of type int" and fail.
https://github.com/ImageOptim/php-imageoptim-api/blob/master/src/Request.php#L163
$status = intval($status[1]);
$errorMessage = $status[2];
I think the issue is that the first line is setting $status to an int, and then trying to treat it like an array in the next line, which PHP 7.4 now throws and exception for (before it would just be null and carry on)
In the process of upgrading php from 7.1 to 7.4 for the app using this library and it looks like 7.4 is a bit more strict with certain things and is causing the following code (line 2) to throw an exception "Trying to access array offset on value of type int" and fail.
https://github.com/ImageOptim/php-imageoptim-api/blob/master/src/Request.php#L163
$status = intval($status[1]);
$errorMessage = $status[2];
I think the issue is that the first line is setting $status to an int, and then trying to treat it like an array in the next line, which PHP 7.4 now throws and exception for (before it would just be null and carry on)
https://www.php.net/manual/en/migration74.incompatible.php
"Array-style access of non-arrays
Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice."
Possible simple fix at the moment is just to swap the two lines around.
The text was updated successfully, but these errors were encountered: