Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#55333 closed defect (bug) (fixed)

PHP Notice in strip_fragment_from_url() when schemeless URI is passed

Reported by: dd32's profile dd32 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Canonical Keywords: has-patch
Focuses: Cc:


Related to [52829] is this PHP Notice that seems to be triggering on a the_content filter after that change:


E_NOTICE: Undefined index: scheme in wp-includes/canonical.php:854
Undefined index: scheme

The input in this case is a URL such as //

I also note that strip_fragment_from_url() doesn't use wp_parse_url() but uses parse_url() directly.

Change History (5)

This ticket was mentioned in PR #2385 on WordPress/wordpress-develop by dd32.

2 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.0

#3 @SergeyBiryukov
2 years ago

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

In 52833:

Canonical: Check if the URL scheme exists in strip_fragment_from_url().

This avoids an "Undefined index" PHP notice when a schemeless URI is passed.

Props dd32, SergeyBiryukov.
Fixes #55333.

#5 @SergeyBiryukov
2 years ago

For reference, strip_fragment_from_url() was added in [35770] / #19918.

Note: See TracTickets for help on using tickets.