Recent update crashes admin panel
-
Hi there,
After updating to version 3.51.2, my sites admin panel immediately crashed with a critical error. I diagnosed the issue via the PHP error logs and found that the plugin is attempting to call
wp_rand()before WordPress has loaded the pluggable functions.PHP Fatal error: Uncaught Error: Call to undefined function wp_rand() in /wp-content/plugins/custom-css-js/includes/admin-screens.php:1417
Stack trace:
#0 /includes/admin-screens.php(1483): CustomCSSandJS_Admin->build_search_tree()
#1 /includes/admin-screens.php(90): CustomCSSandJS_Admin->update_custom_codes_for_block_editor()
#2 /includes/admin-screens.php(36): CustomCSSandJS_Admin->add_functions()
#3 /includes/admin-screens.php(1796): CustomCSSandJS_Admin->__construct()The Issue: It appears that
build_search_tree()is being triggered via the constructor chain (__construct->add_functions->update_custom_codes_for_block_editor).Because the main plugin instance is initialized directly in
custom-css-js.php, this code executes before WordPress has loadedpluggable.php(wherewp_randis defined).The Temporary Fix: I was able to restore my admin panel by manually editing
/includes/admin-screens.phpon line 1417 and replacingwp_rand()with the native PHPrand().// 3.51.2 code causing crash:
// $filename .= '?v=' . wp_rand( 1, 10000 );
// Working fix:
$filename .= '?v=' . rand( 1, 10000 );Could you please patch this in the next release?
Thanks!
You must be logged in to reply to this topic.