Register $allowed_files as a WordPress global (fix 500 on theme-editor.php)#45
Open
Spomky wants to merge 1 commit into
Open
Register $allowed_files as a WordPress global (fix 500 on theme-editor.php)#45Spomky wants to merge 1 commit into
Spomky wants to merge 1 commit into
Conversation
wp-admin/theme-editor.php builds $allowed_files at script scope and relies on it being a true global. Because WordpressLoader requires the WP entry point inside a method, only the names listed in WordpressGlobals::GLOBALS become real globals. allowed_files was missing, so get_file_description() read null and triggered a 500 (Trying to access array offset on null). Fixes phpsword#44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening
wp-admin/theme-editor.phpreturns an HTTP 500:Cause
WordpressLoader::createWordpressResponse()requires the WordPress entry point inside a method, so only the names listed inWordpressGlobals::GLOBALSare promoted to real globals.theme-editor.phpbuilds$allowed_filesat script scope and expects it to be a true global;get_file_description()later reads it viaglobal $allowed_files;. Asallowed_fileswas missing from the list, the array stayed local to the method and the function readnull.The sibling global
wp_file_descriptions, used in the same function, was already present —allowed_fileswas just omitted.Change
Adds
'allowed_files'toWordpressGlobals::GLOBALS(kept in alphabetical order).Closes #44