Description
Loading wp-admin/theme-editor.php through the bundle results in an HTTP 500:
Warning: Trying to access array offset on null
at wp-admin/includes/file.php line 84
Root cause
WordpressLoader::createWordpressResponse() requires the WordPress entry point inside a method scope, and only the variables listed in WordpressGlobals::GLOBALS are promoted to real globals via the global $$global; loop.
theme-editor.php builds $allowed_files at script level, expecting it to be a true global. Later, wp_print_theme_file_tree() → get_file_description() does global $allowed_files; and reads it. Since allowed_files is missing from WordpressGlobals::GLOBALS, the array built by theme-editor.php stays local to the method, so get_file_description() reads null → $allowed_files[$file] → warning → 500.
Note: wp_file_descriptions (the sibling global used in the very same function) is already in the list — allowed_files was simply omitted.
Fix
Add 'allowed_files' to WordpressGlobals::GLOBALS (alphabetically, between all_links and allowedentitynames). A PR follows.
Description
Loading
wp-admin/theme-editor.phpthrough the bundle results in an HTTP 500:Root cause
WordpressLoader::createWordpressResponse()requires the WordPress entry point inside a method scope, and only the variables listed inWordpressGlobals::GLOBALSare promoted to real globals via theglobal $$global;loop.theme-editor.phpbuilds$allowed_filesat script level, expecting it to be a true global. Later,wp_print_theme_file_tree()→get_file_description()doesglobal $allowed_files;and reads it. Sinceallowed_filesis missing fromWordpressGlobals::GLOBALS, the array built bytheme-editor.phpstays local to the method, soget_file_description()readsnull→$allowed_files[$file]→ warning → 500.Note:
wp_file_descriptions(the sibling global used in the very same function) is already in the list —allowed_fileswas simply omitted.Fix
Add
'allowed_files'toWordpressGlobals::GLOBALS(alphabetically, betweenall_linksandallowedentitynames). A PR follows.