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
Describe the bug
User reports the following error:
Fatal error: Uncaught TypeError: str_replace(): Argument #1 ($search) must be of type array|string, null given in /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php:152 Stack trace: #0 /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php(152): str_replace(NULL, '160.153.168.4', '/var/www/wp-con...') #1 /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php(107): WP_Rocket\ThirdParty\Hostings\Godaddy->purge_request('BAN', '/var/www/wp-con...') #2 /var/www/wp-includes/class-wp-hook.php(324): WP_Rocket\ThirdParty\Hostings\Godaddy->clean_file('/var/www/wp-con...') #3 /var/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /var/www/wp-content/plugins/wp-rocket/inc/functions/files.php(585): do_action('before_rocket_c...', '/var/www/wp-con...') #6 /var/www/wp-content/plugins/wp-rocket/inc/common/purge.php(249): rocket_clean_files(Array) #7 /var/www/wp-includes/class-wp-hook.php(326): rocket_clean_post(23593) #8 /var/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #9 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /var/www/wp-includes/post.php(7436): do_action('clean_post_cach...', 23593, Object(WP_Post)) #11 /var/www/wp-includes/post.php(4761): clean_post_cache(Object(WP_Post)) #12 /var/www/wp-includes/post.php(4995): wp_insert_post(Array, false, true) #13 /var/www/wp-admin/includes/post.php(453): wp_update_post(Array) #14 /var/www/wp-admin/post.php(227): edit_post() #15 {main} thrown in /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php on line 152
To Reproduce
Not entirely sure what causes it, but any case out of WP Rocket's control where wp_parse_url() returns anything other than a string or array would cause this error.
Expected behavior
We should protect against cases we can't control where wp_parse_url() returns value of type other than string or array by doing a type check here:
Describe the bug
User reports the following error:
Fatal error: Uncaught TypeError: str_replace(): Argument #1 ($search) must be of type array|string, null given in /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php:152 Stack trace: #0 /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php(152): str_replace(NULL, '160.153.168.4', '/var/www/wp-con...') #1 /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php(107): WP_Rocket\ThirdParty\Hostings\Godaddy->purge_request('BAN', '/var/www/wp-con...') #2 /var/www/wp-includes/class-wp-hook.php(324): WP_Rocket\ThirdParty\Hostings\Godaddy->clean_file('/var/www/wp-con...') #3 /var/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /var/www/wp-content/plugins/wp-rocket/inc/functions/files.php(585): do_action('before_rocket_c...', '/var/www/wp-con...') #6 /var/www/wp-content/plugins/wp-rocket/inc/common/purge.php(249): rocket_clean_files(Array) #7 /var/www/wp-includes/class-wp-hook.php(326): rocket_clean_post(23593) #8 /var/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #9 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /var/www/wp-includes/post.php(7436): do_action('clean_post_cach...', 23593, Object(WP_Post)) #11 /var/www/wp-includes/post.php(4761): clean_post_cache(Object(WP_Post)) #12 /var/www/wp-includes/post.php(4995): wp_insert_post(Array, false, true) #13 /var/www/wp-admin/includes/post.php(453): wp_update_post(Array) #14 /var/www/wp-admin/post.php(227): edit_post() #15 {main} thrown in /var/www/wp-content/plugins/wp-rocket/inc/ThirdParty/Hostings/Godaddy.php on line 152
To Reproduce
Not entirely sure what causes it, but any case out of WP Rocket's control where
wp_parse_url()
returns anything other than astring
orarray
would cause this error.Expected behavior
We should protect against cases we can't control where
wp_parse_url()
returns value of type other thanstring
orarray
by doing a type check here:wp-rocket/inc/ThirdParty/Hostings/Godaddy.php
Line 152 in 4542d7b
Additional context
Ticket - https://secure.helpscout.net/conversation/2771218400/525430
The text was updated successfully, but these errors were encountered: