Make WordPress Core

Opened 9 months ago

Closed 8 months ago

#60209 closed defect (bug) (fixed)

X-Redirect-By type incomplete

Reported by: kkmuffme's profile kkmuffme Owned by: swissspidy's profile swissspidy
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: HTTP API Keywords: has-patch
Focuses: Cc:

Description

Setting the type to false (or any non-string) value, will disable sending the header.

I suggest adding false as type to document this behavior to make clear that false can be passed to NOT set this header.

Change History (5)

This ticket was mentioned in PR #5845 on WordPress/wordpress-develop by @kkmuffme.


9 months ago
#1

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by kkmuffme. View the logs.


8 months ago

#3 @swissspidy
8 months ago

  • Component changed from General to HTTP API
  • Milestone changed from Awaiting Review to 6.5

Introduced in #42313

As much as I'd wish we don't need this and simply cast this to a string, it looks like some plugins are relying on this existing, yet undocumented, behavior.

#4 @kkmuffme
8 months ago

I'm definitely in favor of keeping this, as removing it with false is a use case that comes in handy in various cases, I just wanted to correct the type annotation.

#5 @swissspidy
8 months ago

  • Owner set to swissspidy
  • Resolution set to fixed
  • Status changed from new to closed

In 57693:

Docs: Improve docblock for $x_redirect_by param in wp_redirect().

The $x_redirect_by parameter is supported by wp_redirect() and wp_safe_redirect() to set the X-Redirect-By header.
It can be modified via the x_redirect_by filter.

This updates the docblock to clarify that false can be passed to disable sending the header, which was previously undocumented behavior.

Props kkmuffme, swissspidy.
Fixes #60209.

Note: See TracTickets for help on using tickets.