[wp-trac] [WordPress Trac] #33821: redirect_canonical does not consider port in $compare_original
WordPress Trac
noreply at wordpress.org
Wed Jun 18 12:30:22 UTC 2025
#33821: redirect_canonical does not consider port in $compare_original
-------------------------------------------------+-------------------------
Reporter: willshouse | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Future
| Release
Component: Canonical | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch has-test-info has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch needs-unit-tests has-test-info => has-patch has-
test-info has-unit-tests
Comment:
Replying to [comment:47 wojtekn]:
> > What I can interpret is:
> > If we redirect
> > Example.com:8080 => Example.com:18889
> > But then can I get redirected to => example.com:18889
> > Leading into a redirect loop? (because there is host strtolower
normalization)
>
> The case normalization is done only for comparison purposes. However,
there is one case that we should preserve:
>
> - Example.com:10200 → example.com:8080 (should redirect but without
changing domain case)
>
> I added this as
`test_different_host_casing_with_port_redirect_without_host_change` test,
and confirmed that the test goes through fine in trunk, but fails with my
patch applied. Then, I applied the change you proposed and confirmed that
this test, along with other tests, goes through. Finally, I added another
test to explicitly test the port redirect for the same host.
I can't think in more scenarios now. At first glance it looks good to me.
I've added some extra code review things in the PR (mostly docs guides)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33821#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list