Repository navigation
Conversation
|
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: @jrf. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: 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. |
|
Just FYI — I am not the jrf that you continue to reference in your PRs |
The problem:
path_is_absolute()only treats a Windows drive-letter path as absolute when a backslash follows the drive letter (C:\foo). A path with a forward slash (C:/foo) falls through and is reported as relative.wp_normalize_path()converts every backslash to a forward slash, so on Windows any normalized absolute path (for exampleC:/wamp/www/wp-content) is wrongly reported as relative. Windows itself accepts/as a separator, soC:/foois a valid absolute path.path_join(), then joins such a path onto the base instead of returning it unchanged, producing<base>/C:/foo.The fix:
path_is_absolute()now accepts either separator afterX:(#^[a-zA-Z]:[\\\\/]#).C:fooand a bareC:still aren't absolute, since a separator is still required.@since 7.2.0changelog entry are updated.wp_normalize_path()is unchanged. The earlier patches on the ticket usedDIRECTORY_SEPARATOR, which the ticket discussion showed doesn't help, because the separator comes from normalization rather than the host OS.Tests:
test_path_is_absolute_accepts_windows_drive_path_with_forward_slashes()coversC:/,C:/WINDOWS,c:/foo/bar,D:/wamp/www/wp-content, and the exact case from the ticket,wp_normalize_path( 'C:\\wamp\\www\\wp-content' ). All five fail on trunk and pass with the fix.test_path_is_absolute_rejects_windows_drive_relative_path()guards against widening the check too far:C:fooandC:stay relative.Tests_Functionsclass passes, and PHPCS and PHPStan report nothing new compared with trunk.Credits: this builds on the report and investigation by @paultgoodchild, with discussion from @jrf, @itowhid06 and @apedog, and the request for unit tests from @audrasjb.
Trac ticket: https://core.trac.wordpress.org/ticket/48289
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5 (planning and verification), Claude Sonnet 5.5 (implementation)
Used for: Implementation, tests, and PR description.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code