wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
683 stars 213 forks source link

PHP fatal error potentially related to ATF and picture tags #6661

Open joejoe04 opened 2 months ago

joejoe04 commented 2 months ago

Before submitting an issue please check that you’ve completed the following steps:

Describe the bug After upgrading to version 3.16, user reported site went down and the following error was logged:

`"PHP Fatal error: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of type string, null given in /www/creatureartteacherlive_491/public/wp-content/plugins/wp-rocket/inc/Engine/Media/AboveTheFold/Frontend/Controller.php:222 Stack trace:

0 /www/creatureartteacherlive_491/public/wp-content/plugins/wp-rocket/inc/Engine/Media/AboveTheFold/Frontend/Controller.php(222): ltrim(NULL, '/')

1 [internal function]: WP_Rocket\Engine\Media\AboveTheFold\Frontend\Controller->WP_Rocket\Engine\Media\AboveTheFold\Frontend{closure}(false)

2 /www/creatureartteacherlive_491/public/wp-content/plugins/wp-rocket/inc/Engine/Media"`

In the Slack discussion, Remy said he thought it may be related to:

Expected behavior The error should not occur for all valid <picture> tag markup.

Additional context Ticket - https://secure.helpscout.net/conversation/2605875796/493242/ Website - https://creatureartteacher.com Slack - https://wp-media.slack.com/archives/C43T1AYMQ/p1716485105461249

Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming

pavel-burminsky commented 1 month ago

Hello,

We have the same problem on our client's website, here is an example https://www.escoffier.edu/about/chef-instructors/albert-schmid/. Is it possible to get it fixed?

joejoe04 commented 13 hours ago

Related: https://secure.helpscout.net/conversation/2662969109/504678/