cloudflare / Cloudflare-WordPress

A Cloudflare plugin for WordPress
https://www.cloudflare.com/wordpress/
BSD 3-Clause "New" or "Revised" License
215 stars 84 forks source link

Hooks.php bug crash site on delete things... #475

Closed anhphammody closed 1 year ago

anhphammody commented 2 years ago

Confirmation

WordPress version

5.9.3

Cloudflare-WordPress version

4.9.1

PHP version

8.0

Expected result

Delete media

Actual result

An error of type E_ERROR was caused in line 172 of the file /www/wwwroot/DOMAIN/wp-content/plugins/cloudflare/src/WordPress/Hooks.php. Error message: Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in /www/wwwroot/DOMAIN/wp-content/plugins/cloudflare/src/WordPress/Hooks.php:172 Stack trace:

0 /www/wwwroot/DOMAIN/wp-content/plugins/cloudflare/src/WordPress/Hooks.php(172): array_merge()

1 /www/wwwroot/DOMAIN/wp-includes/class-wp-hook.php(309): CF\WordPress\Hooks->purgeCacheByRelevantURLs()

2 /www/wwwroot/DOMAIN/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()

3 /www/wwwroot/DOMAIN/wp-includes/plugin.php(474): WP_Hook->do_action()

4 /www/wwwroot/DOMAIN/wp-includes/post.php(6390): do_action()

5 /www/wwwroot/DOMAIN/wp-admin/upload.php(197): wp_delete_attachment()

6 {main}

thrown

Steps to reproduce

Delete media

Additional factoids

No response

References

No response

midweste commented 2 years ago

By any chance are you using the hook 'cloudflare_purge_by_url'? If so, can you verify it's not returning a null value?

If not, can you explain the steps you're taking

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.