-
Notifications
You must be signed in to change notification settings - Fork 843
Description
Impacted plugin
Jetpack
Quick summary
Got an array null error on line 298 of the photon-cdn.php which caused a fatal error. Successfully implemented a patch, but not sure if this is something that will be flagged for a fix in future updates or if it's unique to my site's environment. Fine with just listing this bug as information for the community.
Steps to reproduce
Hi! Forgive me, I'm not super familiar with GitHub, but wanted to submit this bug. I got a fatal error on my site craftanddesignrva.com:
An error of type E_ERROR was caused in line 298 of the file /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php. Error message: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php:298
I have set up staging at craftdesig1stg.wpenginepowered.com and successfully implemented this patch on lines 296-298 of photon-cdn.php:
if ( is_array( $body ) && isset( $body['files'] ) && is_array( $body['files'] ) ) {
$return = array_filter(
array_keys( $body['files'] ),
array( CLASS, 'is_js_or_css_file' )
);
}
Is this a bug that will be addressed in future updates, or something I should fix within my hosting or site structure? And if this isn't the place for that type of support, I'm fine with this thread being purely informational.
Versions:
• Jetpack: 15.0.2
• WooCommerce: 10.2.2
• WordPress: 6.8.3
• PHP: 8.2
• Hosting: WPEngine
Full error:
An error of type E_ERROR was caused in line 298 of the file /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php. Error message: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php:298
Stack trace:
#0 /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php(298): array_keys(NULL)
#1 /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php(195): Jetpack_Photon_Static_Assets_CDN::get_plugin_assets('woocommerce', '10.2.2')
#2 /nas/content/live/craftdesig1stg/wp-content/plugins/jetpack/modules/photon-cdn.php(114): Jetpack_Photon_Static_Assets_CDN::cdnize_plugin_assets('woocommerce', '10.2.2')
#3 /nas/content/live/craftdesig1stg/wp-includes/class-wp-hook.php(324): Jetpack_Photon_Static_Assets_CDN::cdnize_assets('')
#4 /nas/content/live/craftdesig1stg/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#5 /nas/content/live/craftdesig1stg/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /nas/content/live/craftdesig1stg/wp-admin/admin-header.php(137): do_action('admin_print_sty...')
#7 /nas/content/live/craftdesig1stg/wp-admin/plugins.php(637): require_once('/nas/content/li...')
#8 {main}
thrown
Site owner impact
More than 60% of the total website/platform users
Severity
Critical
What other impact(s) does this issue have?
Individual site owner revenue
If a workaround is available, please outline it here.
Staging: craftdesig1stg.wpenginepowered.com
Successfully implemented patch on lines 296-298 of photon-cdn.php:
if ( is_array( $body ) && isset( $body['files'] ) && is_array( $body['files'] ) ) {
$return = array_filter(
array_keys( $body['files'] ),
array( CLASS, 'is_js_or_css_file' )
);
}
Platform (Simple and/or Atomic)
Simple
Metadata
Metadata
Assignees
Labels
Type
Projects
Status