I hope this message finds you well. I am encountering a PHP Fatal Error within the AdvancedAds plugin on my website, and I’d like to report it for assistance in resolving the issue.
Here are the details of our setup:
- WordPress Version: 6.4
- Advanced Ads Version: 1.47.3
- Advanced Ads Pro Version: 2.24.2
The error was discovered yesterday and appears to be occurring only in posts where we use the automatic ad insertion feature. We utilize the placement with the jQuery selector
.post-content p:eq(1) for this purpose. This specific placement is necessary because the automatic placement using 2 paragraphs does not work correctly within the Elementor page builder, for reasons unknown to us.
Here’s the error message along with the relevant stack trace (with anonymized paths):
[08-Nov-2023 10:08:07 UTC] PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /wp-includes/media.php:5771 Stack trace: #0 /wp-includes/media.php(1961): wp_get_loading_optimization_attributes('img', Array, Array) #1 /wp-content/plugins/advanced-ads/classes/ad_type_abstract.php(174): wp_img_tag_add_loading_optimization_attrs('<img src="https://projectdmc.org/support/topic/php-fatal-error-wp_get_loading_optimization_attributes/https...", Array) ...
The temporary solution I implemented was to remove lines 172 to 175 in the file
/wp-content/plugins/advanced-ads/classes/ad_type_abstract.php. While this resolved the issue for now, I would appreciate your guidance on whether there is a more official fix or if this will be addressed in future updates.
Thank you for your prompt assistance in resolving this issue. If you need any further information from me, please let me know.