WordPress.org

Make WordPress Core

Opened 2 weeks ago

Last modified 9 days ago

#52252 new defect (bug)

PHP Notice when `monthnum` query var is set without the `year` QV

Reported by: dd32 Owned by:
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Query Keywords: good-first-bug has-patch
Focuses: Cc:

Description

E_NOTICE: Undefined index: year in wp-includes/rewrite.php:413 / E_NOTICE: Undefined index: day in wp-includes/rewrite.php:413

It looks like [32648] assumes the permalink structures will always include both year & monthnum or monthnum & day https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rewrite.php?marks=400-403#L393

But a request such as ?monthnum=1 will cause it to check for the year query var which might be unset.

(Props to the pentester hitting WordPress.org with many junk requests for bringing this to light)

Attachments (1)

52252.patch (571 bytes) - added by ovidiul 9 days ago.
adding array_key_exists check

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
2 weeks ago

  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to 5.7

@ovidiul
9 days ago

adding array_key_exists check

#2 @ovidiul
9 days ago

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.