Make WordPress Core

Opened 6 years ago

Closed 2 years ago

#45513 closed defect (bug) (fixed)

Notice: Undefined index: year

Reported by: 1naveengiri's profile 1naveengiri Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.1 Priority: normal
Severity: normal Version: 5.0
Component: Permalinks Keywords: has-screenshots has-patch
Focuses: Cc:


With permalink structure /%postname%/%monthnum%/

When I visit a post in frontend it throw me a notice

Notice: Undefined index: year at wp-includes/rewrite.php:387

Attachments (3)

Screenshot 2018-12-07 at 10.00.46 AM.png (448.6 KB) - added by 1naveengiri 6 years ago.
error.png (141.1 KB) - added by mukesh27 6 years ago.
Error when we check frontend.
45513.patch (849 bytes) - added by mukesh27 6 years ago.
Please try this patch it working fine for me.

Download all attachments as: .zip

Change History (11)

#1 @mukesh27
6 years ago

  • Keywords has-screenshots needs-testing dev-feedback added

Nice cache @1naveengiri

Confirm if we use /%postname%/%monthnum%/ in Custom Structure then in front end it show attached Notice: Undefined index: year in /mukesh/wordpress5.0/wp-includes/rewrite.php on line 387

Last edited 6 years ago by mukesh27 (previous) (diff)

6 years ago

Error when we check frontend.

6 years ago

Please try this patch it working fine for me.

#2 @mukesh27
6 years ago

  • Keywords has-patch added; needs-patch removed

#3 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @pento
6 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from 5.1 to Future Release

This will need fairly careful testing and review for back compat issues.

Unit tests would be useful here.

#5 @1naveengiri
5 years ago

Hi Guys,

Just a friendly follow-up,

do we have any recent plan for it? seems a very long waiting time for this ticket.


#7 @SergeyBiryukov
2 years ago

In 53861:

Tests: Improve the test for not throwing a warning on malformed date queries.

  • Make it specifically about wp_resolve_numeric_slug_conflicts(), the function that was throwing an Undefined array key "year" PHP warning for malformed date requests.
  • Move the test under the rewrite component and make its name a bit more descriptive.
  • Check the return result of the function instead of performing a dummy assertion.
  • Use named array keys in the data provider for clarity.
  • Add missing @covers tag.

Follow-up to [32648], [53857].

Props costdev, peterwilsoncc, 1naveengiri, mukesh27, SergeyBiryukov.
See #52252, #45513.

#8 @SergeyBiryukov
2 years ago

  • Keywords needs-testing dev-feedback needs-unit-tests removed
  • Milestone changed from Future Release to 6.1
  • Resolution set to fixed
  • Status changed from reviewing to closed

Hi there, thanks for the ticket and the patch! Sorry it took so long for someone to get back to you.

I believe this is fixed in [53857] and [53861]. The props from this ticket are included in the latter commit.

Note: See TracTickets for help on using tickets.