PHP Error: Trying to access array offset on value of type bool
-
@optimizingmatters the previous thread has been makrked as resolved: https://wordpress.org/support/topic/php-error-croc-slider-trying-to-access-array-offset-on-value-of-type-bool/#post-15203616 BUT we are still having the same issue even after updating to 2.9.4:
Notice: Trying to access array offset on value of type bool in /home/site/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 1374
Creating a new thread as not sure if you will get notified that the issue still exists as that ones marked as resolved!
How can this be fixed please?
-
That’s … unexpected.
OK, let’s start from scratch with some questions:
* what are your settings on the image tab (image optimization & lazyload)?
* where are you seeing the notice, in the PHP errorlog or on a page (and if the latter: on front-end or wp-admin)?
* what PHP version are you using?
* can you double-check the error message and specifically the line number (as 1374 does not contain any array/bool logic)?frank
Hello Frank / @optimizingmatters
Thanks for the quick reply.
OK, answers to your questions:
* what are your settings on the image tab (image optimization & lazyload)?
No options selected. Actually at the moment the ONLY option checked from the whole plugin is optimise html* where are you seeing the notice, in the PHP errorlog or on a page (and if the latter: on front-end or wp-admin)?
In the php error log (enabled wp debug log file) as follows:[29-Dec-2021 12:52:35 UTC] PHP Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 214 [29-Dec-2021 12:52:35 UTC] PHP Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 214 [29-Dec-2021 12:52:35 UTC] PHP Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 215 [29-Dec-2021 12:52:35 UTC] PHP Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 215 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1098 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1098 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1107 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1107 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1153 [29-Dec-2021 12:53:35 UTC] PHP Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 1153
AND on the frontend (see below) AND only in the back end on the image setting page as per this screenshot: https://imgur.com/a/77gkJ0K
* what PHP version are you using?
php 7.4.27 (Supports 64bit values)* can you double-check the error message and specifically the line number (as 1374 does not contain any array/bool logic)?
on the frontend here is the error message (1374 line number was from the previous plugin version which now no longer shows but are now different numbers?!):Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 214 Notice: Trying to access array offset on value of type null in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 214 Notice: Trying to access array offset on value of type bool in /home/site/public_html/app/plugins/autoptimize/classes/autoptimizeImages.php on line 215
I also tested this on a dev install on a different hosting platform (above is cpanel this one is different) and it has the same results.
on this platform Php version is: 7.4.27 (Supports 64bit values)
again shows error on the plugins image settings page only in backend as per this screenshot: https://imgur.com/a/EEbXppK
on the frontend it has the same error message:
Notice: Trying to access array offset on value of type bool in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 214 Notice: Trying to access array offset on value of type null in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 214 Notice: Trying to access array offset on value of type bool in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 215 Notice: Trying to access array offset on value of type null in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 215
the standard error log shows the following:
[Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Notice: Trying to access array offset on value of type bool in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 214' [Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Notice: Trying to access array offset on value of type null in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 214' [Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Notice: Trying to access array offset on value of type bool in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 215' [Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Notice: Trying to access array offset on value of type null in /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 215' [Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php:214) in /home/sites/5b/1/108c1e5d59/public_html/wp-includes/pluggable.php on line 1340' [Wed Dec 29 13:03:46 2021] [error] [client 92.23.83.126:0] AH01071: Got error 'PHP message: PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sites/5b/1/108c1e5d59/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php:214) in /home/sites/5b/1/108c1e5d59/public_html/wp-includes/pluggable.php on line 1343'
Currently dont have the wp debug log file activated on this dev site BUT pretty confident it would show the same errors…
Hope the above information helps to narrow down the bug and get a fix?
OK, so the good news is 2.9.4 indeed did solve the problem on line 1374 (which is now 1375), the bad news is there are more to fix (line 214, 215, 1098, 1107 and 1153).
I’ll look into those the next couple of days and ping you when there’s an updated beta-version to test 🙂
@optimizingmatters thank for the reply.
great, look foward to your ping!
OK, turned out to be a very silly mistake with a closing bracket at the wrong place .. can you download the beta here and install it instead of 2.9.4 to test on one or more of your sites?
Hello @optimizingmatters
Fantastic! That beta version seems to have fixed the issue 🙂 tested in both enviroments and its now fixed.
Many thanks for you quick replies and even faster support. Stellar!
Happy to read that, the fix will be in the next official update (not sure if that will be 2.9.5 or 2.10.0 or even 3.0.0, the choices the choices …)
No problem at all.
next official update (not sure if that will be 2.9.5 or 2.10.0 or even 3.0.0, the choices the choices …)
you forgot 2.9.5.1 or 2.9.5.1.1 🙂
- The topic ‘PHP Error: Trying to access array offset on value of type bool’ is closed to new replies.