Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 800 forks source link

WP Super Cache causing "Uncaught TypeError" #37438

Open rob-kne opened 3 months ago

rob-kne commented 3 months ago

Impacted plugin

Super Cache

Quick summary

Wordpress gives out error message because of WP Super Cache plugin, more info see below.

Steps to reproduce

For some days now I daily get an error message from Wordpress saying my website has a "technical error".

In the error details it says the following (in German due to my localization):

WordPress-Version 6.5.3 Aktives Theme: OceanWP (Version 3.5.5) Aktuelles Plugin: WP Super Cache (Version 1.12.1) PHP-Version 8.2.18

Fehler-Details

Ein Fehler vom Typ E_ERROR wurde in der Zeile 2937 der Datei /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php verursacht. Fehlermeldung: Uncaught TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php:2937 Stack trace:

0 /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php(2937): array_unshift()

1 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(326): wp_cache_plugin_actions()

2 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(205): WP_Hook->apply_filters()

3 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/modules/class-callables.php(377): apply_filters()

4 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Modules\Callables->set_plugin_action_links()

5 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()

6 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(517): WP_Hook->do_action()

7 /srv/www/htdocs/mydomainname/wp-admin/includes/class-wp-screen.php(424): do_action()

8 /srv/www/htdocs/mydomainname/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()

9 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(527): set_current_screen()

10 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(629): Automattic\Jetpack\Sync\Sender->get_items_to_send()

11 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(484): Automattic\Jetpack\Sync\Sender->do_sync_for_queue()

12 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(359): Automattic\Jetpack\Sync\Sender->do_sync_and_set_delays()

13 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(739): Automattic\Jetpack\Sync\Sender->do_sync()

14 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(679): Automattic\Jetpack\Sync\Actions::do_cron_sync_by_type()

15 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Actions::do_cron_sync()

16 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()

17 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(565): WP_Hook->do_action()

18 /srv/www/htdocs/mydomainname/wp-cron.php(191): do_action_ref_array()

19 {main}

thrown


Do you have any idea how to get rid of this error? Many thanks in advance.

A clear and concise description of what you expected to happen.

No response

What actually happened

No response

Impact

All

Available workarounds?

There is no user impact

Platform (Simple and/or Atomic)

Self-hosted

Logs or notes

For some days now I daily get an error message from Wordpress saying my website has a "technical error".

In the error details it says the following (in German due to my localization):

WordPress-Version 6.5.3 Aktives Theme: OceanWP (Version 3.5.5) Aktuelles Plugin: WP Super Cache (Version 1.12.1) PHP-Version 8.2.18

Fehler-Details

Ein Fehler vom Typ E_ERROR wurde in der Zeile 2937 der Datei /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php verursacht. Fehlermeldung: Uncaught TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php:2937 Stack trace:

0 /srv/www/htdocs/mydomainname/wp-content/plugins/wp-super-cache/wp-cache.php(2937): array_unshift()

1 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(326): wp_cache_plugin_actions()

2 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(205): WP_Hook->apply_filters()

3 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/modules/class-callables.php(377): apply_filters()

4 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Modules\Callables->set_plugin_action_links()

5 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()

6 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(517): WP_Hook->do_action()

7 /srv/www/htdocs/mydomainname/wp-admin/includes/class-wp-screen.php(424): do_action()

8 /srv/www/htdocs/mydomainname/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()

9 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(527): set_current_screen()

10 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(629): Automattic\Jetpack\Sync\Sender->get_items_to_send()

11 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(484): Automattic\Jetpack\Sync\Sender->do_sync_for_queue()

12 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(359): Automattic\Jetpack\Sync\Sender->do_sync_and_set_delays()

13 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(739): Automattic\Jetpack\Sync\Sender->do_sync()

14 /srv/www/htdocs/mydomainname/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(679): Automattic\Jetpack\Sync\Actions::do_cron_sync_by_type()

15 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Actions::do_cron_sync()

16 /srv/www/htdocs/mydomainname/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()

17 /srv/www/htdocs/mydomainname/wp-includes/plugin.php(565): WP_Hook->do_action()

18 /srv/www/htdocs/mydomainname/wp-cron.php(191): do_action_ref_array()

19 {main}

thrown


Do you have any idea how to get rid of this error? Many thanks in advance.

fgiannar commented 3 months ago

@rob-kne Many thanks for the report! Could you please provide the version of the Jetpack plugin you are using or try updating Jetpack to the latest version and confirm you are still getting this error?

rob-kne commented 3 months ago

I am using the current version 13.4.3 of the Jetpack plugin,

fgiannar commented 3 months ago

Adding a note here that I've audited the Sync related part, where we apply the plugin_action_links filter and we ensure that the corresponding $actions argument is an array.

donnchawp commented 2 months ago

@rob-kne does this still happen when using WP Super Cache 1.12.3? I couldn't replicate the problem, but I added an is_array() check in #37604. The new version released on Thursday has this fix.