Opened 13 months ago
Closed 12 months ago
#63224 closed defect (bug) (fixed)
Undefined array key "QUERY_STRING" in _wp_get_site_editor_redirection_url()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.8 | Priority: | normal |
| Severity: | normal | Version: | 6.9 |
| Component: | Editor | Keywords: | has-patch dev-feedback |
| Focuses: | Cc: |
Description (last modified by )
Got one Warning message in the Twenty Twenty-Five theme while opening in Appearance>Editor
WordPress Version - development version (6.8-RC2)
PHP Version - 8.2
Warning - Undefined array key "QUERY_STRING" in .../site-editor.php on line 34
Warning - Cannot modify header information- headers already sent by (output started at .../site-editor.php on line 34) in .../wp-admin/admin-header.php on line 14
Attachments (2)
Change History (20)
#1
@
13 months ago
Hey @akshaydhere,
Thank you for bringing up the issue. I attempted to replicate it but was unable to do so. I have attached a video referencing the steps I took.
Could you please check if I might be missing anything? Also, can you try testing it on a fresh WordPress installation?
Video: 6.8.RC, 6.9-alpha-60093-src
Environment
- WordPress: 6.8-RC2
- PHP: 8.2.27
- Server: nginx/1.16.0
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.27)
- Browser: Chrome 135.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.1
- MU Plugins: None activated
- Plugins: Test Reports 1.2.0
#2
@
13 months ago
- Component changed from Themes to Editor
- Description modified (diff)
- Milestone changed from Awaiting Review to 6.8
- Summary changed from Minor Code Improvement : Warning Cannot modify header information to Undefined array key "QUERY_STRING" in _wp_get_site_editor_redirection_url()
- Version set to trunk
I did not find a way to receive the warning either, but I checked the history:
- [59794] added the
_wp_get_site_editor_redirection_url()function. - One of the commits in GB67199 changed the condition, removing
isset()when it correctedQUERY_STRING.
#3
@
13 months ago
- Focuses php-compatibility added
- Keywords has-patch needs-testing needs-testing-info added
@sabernhardt @sainathpoojary We can fix this by using the empty() checker instead of !.
I've attached the patch for testing.
#4
@
13 months ago
- Keywords has-testing-info added; needs-testing-info removed
Test Summary:
A warning message was encountered while accessing the WordPress Site Editor under the Twenty Twenty-Five theme in WordPress version 6.8-RC2 with PHP 8.2.27. The issue was not reproducible in the local environment or WordPress Playground.
Test Environment:
WordPress Version: 6.8-RC2 (development version)
PHP Version: 8.2.27
Theme: Twenty Twenty-Five 1.1
Testing Environments:
Local WordPress installation
WordPress Playground
Steps to Reproduce:
Navigate to WordPress Admin Panel.
Go to Appearance > Editor.
Observe if any warnings or errors appear.
Observed Results:
Locally, no warning messages were observed.
In WordPress Playground, no warning messages were observed.
However, in a specific instance, the following warning appeared:
Warnings:
Warning: Undefined array key "QUERY_STRING" in .../site-editor.php on line 34
Warning: Cannot modify header information - headers already sent by (output started at .../site-editor.php on line 34) in .../wp-admin/admin-header.php on line 14
Expected Results:
The Site Editor should open without any warnings or errors.
Possible Causes & Analysis:
The issue might be environment-specific and could be triggered under certain server configurations.
The QUERY_STRING key might not always be set in the $_SERVER superglobal, leading to an undefined array key warning.
The warning output might cause early header output, leading to the headers already sent issue.
A recent change in WordPress 6.8-RC2 might be affecting this behavior.
Recommendations & Next Steps:
Debugging Approach:
Check $_SERVER contents before accessing QUERY_STRING.
Modify site-editor.php line 34 to ensure the key exists before usage:
$query_string = $_SERVERQUERY_STRING? ?? ;
Verify Reproducibility in Other Setups:
Test in a fresh WordPress installation with PHP 8.2.27.
Check if the issue persists across different hosting environments.
Report to WordPress Core Team:
If the issue is confirmed, report it as a bug in the WordPress Core Trac or GitHub.
Conclusion:
The issue was observed in a specific scenario but was not reproducible in all environments. Further investigation is needed to determine the root cause and provide a fix if necessary.
This ticket was mentioned in Slack in #core-committers by audrasjb. View the logs.
13 months ago
#8
@
12 months ago
- Resolution set to worksforme
- Status changed from new to closed
Test Summary:
A warning message was encountered while accessing the WordPress Site Editor under the Twenty Twenty-Five theme in WordPress version 6.8-RC2 with PHP 8.3.11.
Test Environment:
WordPress Version: 6.8-RC2 (development version)
PHP Version: 8.3.11
Theme: Twenty Twenty-Five 1.1
Testing Environments:
Local WordPress installation
WordPress Playground
Steps to Reproduce:
Navigate to WordPress Admin Panel.
Go to Appearance > Editor.
Observe if any warnings or errors appear.
Observed Results:
No errors or warnings were observed visually or in the debug.log. The issue might be observed in some specific environments, need info for replication of issue.
#9
@
12 months ago
I have checked the issue about the Warning message in the Twenty Twenty-Five theme while opening in Appearance>Editor, But couldn't find any such issue in my local environment.
Environment
- WordPress: 6.8-RC2
- PHP: 8.2.27
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.27)
- Browser: Chrome 134.0.0.0
- OS: Linux
- Theme: Twenty Twenty-Five 1.1
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
#10
@
12 months ago
- Focuses php-compatibility removed
- Resolution worksforme deleted
- Status changed from closed to reopened
cc: @youknowriad
#11
@
12 months ago
The environment in which I was able to reproduce this is Studio.
Presumably, whether $_SERVER['QUERY_STRING'] becomes undefined or an empty string when the query parameter is not present in the URL depends on the server type and settings.
However, I don't understand why this server variable is being checked in the first place. I read all the core ticket and Gutenberg PR related to this code, but I couldn't find out the reason.
In my opinion, this check should be able to be removed. Or is it a safeguard in case this internal function is called unintentionally from some special circumstances?
cc @joemcgill @Mamaduka @peterwilsoncc for visibility
#12
@
12 months ago
@wildworks I believe these changes were made two months ago in this [GitHub issue]https://github.com/WordPress/wordpress-develop/issues/62585.
Ref: https://tinyurl.com/25lllqs5
I haven't reviewed the discussion in that ticket because I'm unable to access it.
#13
@
12 months ago
- Keywords commit added
- Owner set to peterwilsoncc
- Status changed from reopened to assigned
I've been able to reproduce this using Studio
I believe that it comes down to PHP configurations, $_SERVER['QUERY_STRING'] can either be an empty string or unset when the URL doesn't contain one.
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: 63224.patch
Environment
- WordPress: 6.9-alpha-60132
- PHP: 8.2.10-dev
- Server: PHP.wasm
- Database: WP_SQLite_Translator (Server: 5.5 / Client: 3.40.1)
- Browser: Firefox 137.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.1
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
I've tested various redirects continue to work as expected. They do.
#15
@
12 months ago
- Keywords dev-feedback added; needs-testing needs-testing-info commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport consideration of [60134] to the 6.8 branch, pending approval from another core committer.
#17
@
12 months ago
Reproduction Report
Description
This report validates whether the issue can be reproduced.
Environment
- WordPress: 6.8-RC2
- PHP: 8.2.10-dev
- Server: PHP.wasm
- Database: WP_SQLite_Translator (Server: 5.5 / Client: 3.40.1)
- Browser: Chrome 134.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.1
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Actual Results
- Was NOT able to replicate the issue using WordPress Playground. ❌

Warning message