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
When trying to generate a static site on my locally-hosted WordPress Multisite installation, I consistently hit a 500 error. Examining the WordPress debug log, I saw this:
[28-Feb-2024 22:16:34 UTC] PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, bool given in /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/DetectPluginAssets.php:42
Stack trace:
#0 /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/DetectPluginAssets.php(42): array_keys()
#1 /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/URLDetector.php(119): WP2Static\DetectPluginAssets::detect()
#2 /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/URLDetector.php(196): WP2Static\URLDetector::detectURLs()
#3 /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/Controller.php(699): WP2Static\URLDetector::enqueueURLs()
#4 /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/Controller.php(811): WP2Static\Controller::wp2staticHeadless()
#5 /srv/www/vhosts/my_site/wp-includes/class-wp-hook.php(306): WP2Static\Controller::wp2staticRun()
#6 /srv/www/vhosts/my_site/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#7 /srv/www/vhosts/my_site/wp-includes/plugin.php(517): WP_Hook->do_action()
#8 /srv/www/vhosts/my_site/wp-admin/admin-ajax.php(188): do_action()
#9 {main}
thrown in /srv/www/vhosts/my_site/wp-content/plugins/wp2static/src/DetectPluginAssets.php on line 42
Line 42 in src/DetectPluginAssets.php was doing array_keys( $active_sitewide_plugins ). A little earlier, line 36 was this:
When trying to generate a static site on my locally-hosted WordPress Multisite installation, I consistently hit a 500 error. Examining the WordPress debug log, I saw this:
Line 42 in
src/DetectPluginAssets.php
was doingarray_keys( $active_sitewide_plugins )
. A little earlier, line 36 was this:...which when I tested it returned
false
. Changing line 36 tosolved the problem. (
'active_sitewide_plugins'
is a network option, it appears.)My recommended fix modifies lines 33-45 or so:
Without the line numbers:
If needed I can make this into a pull request.
The text was updated successfully, but these errors were encountered: