Repository navigation
Bootstrap/Load: Avoid duplicating the query string in wp_fix_server_vars() on IIS - #16125
ankit-addweb wants to merge 1 commit into
Conversation
…vars()` on IIS. When `REQUEST_URI` already contains the query string, `wp_fix_server_vars()` appended `QUERY_STRING` a second time, producing URLs like `/foo/?a=1&b=2?a=1&b=2`. The query string is now only appended when `REQUEST_URI` has no `?`. Adds unit tests for `wp_fix_server_vars()`. See #44766. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @ankit-addweb. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/44766
What changed
wp_fix_server_vars()(src/wp-includes/load.php) now appendsQUERY_STRINGto
REQUEST_URIonly ifREQUEST_URIdoesn't already contain a?.tests/phpunit/tests/load/wpFixServerVars.phpcovering the function,including a regression case for the duplicated query string.
Why
On IIS, when no rewrite headers or
PATH_INFOare present,REQUEST_URIcan already include the query string. The function then added it again:
/foo/?a=1&b=2became/foo/?a=1&b=2?a=1&b=2.How to test
npm run test:php -- --filter Tests_Load_WpFixServerVarsload.phpand confirm the"IIS with a REQUEST_URI that already has the query string" case fails.
Notes
$_SERVERvalues.cgi-fcgiSAPI exclusion can't be unit-tested becausePHP_SAPIis a constant.🤖 Generated with Claude Code