-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Hints error: null passed to delete_by_url() when string expected #6887
Comments
Faced the same issue preventing upload any media or plugins, error Uploading media work again if deactivate WPRocket Another way is a hotfix until it's fixed by plugin's authors in replace the delete_by_url method with
|
In 2 additional cases, users can also see the following message in the media uploader:
And the error reported appears in the logs:
tickets: |
Before submitting an issue please check that you’ve completed the following steps:
Describe the bug
Users on 3.16.4 reporting the following error being logged:
[14-Aug-2024 17:34:32 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to WP_Rocket\Engine\Common\PerformanceHints\Admin\Controller::delete_by_url() must be of the type string, null given, called in /home/customer/www/mabelkatz.com/public_html/espanol/wp-content/plugins/wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Controller.php on line 81 and defined in /home/customer/www/mabelkatz.com/public_html/espanol/wp-content/plugins/wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Controller.php:177
Stack trace:
#0 /home/customer/www/mabelkatz.com/public_html/espanol/wp-content/plugins/wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Controller.php(81): WP_Rocket\Engine\Common\PerformanceHints\Admin\Controller->delete_by_url(NULL)
#1 /home/customer/www/mabelkatz.com/public_html/espanol/wp-content/plugins/wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Subscriber.php(64): WP_Rocket\Engine\Common\PerformanceHints\Admin\Controller->delete_post(187146)
#2 /home/customer/www/mabelkatz.com/public_html/espanol/wp-includes/class-wp-hook.php(326 in /home/customer/www/mabelkatz.com/public_html/espanol/wp-content/plugins/wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Controller.php on line 177
It's related to attachments and this bit of code:
wp-rocket/inc/Engine/Common/PerformanceHints/Admin/Controller.php
Lines 75 to 82 in d499588
It seems some plugins are returning
null
for attachment$url
s. The code above only returns if$url
is exactlyfalse
, allowingnull
to get past.Could instead do something like this:
To Reproduce
Steps to reproduce the behavior:
null
for attachment URLsWe're not sure exactly which plugins are doing this, but we have 3 cases reported so far that use a variety of different plugins.
@wordpressfan said it can be reproduced with this:
Expected behavior
Any time the
$url
value is not a string, we should return to stop processing.Additional context
Slack: https://wp-media.slack.com/archives/C43T1AYMQ/p1723658183566389
Case1: https://secure.helpscout.net/conversation/2679645797/507641/
Case2: https://secure.helpscout.net/conversation/2684619765/508416/
Case3: https://secure.helpscout.net/conversation/2685184550/508504/
Acceptance Criteria (for WP Media team use only)
Clear instructions for developers, to be added before the grooming
The text was updated successfully, but these errors were encountered: