Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11490 closed defect (bug) (fixed)

Notice: Undefined offset: 0 in link-manager.php

Reported by: ShaneF Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Warnings/Notices Keywords: has-patch commit
Focuses: Cc:


The Problem

I was working on a new WordPress design and I set the very first post to Jan, 1, 2010, 12:00am and when previewing the file I got this error:

Notice: Undefined offset: 0 in /home/xxxx/public_html/wordpress/wp-includes/link-template.php on line 1117

What happens…

$post = $posts[0];

is still being set even if $posts might be empty. Moving the check to see if $posts is empty instead of $post fixes the issue nicely.

Attachments (1)

11490.diff (971 bytes) - added by ShaneF 6 years ago.

Download all attachments as: .zip

Change History (5)

6 years ago

#1 @westi
6 years ago

  • Milestone changed from 2.9.1 to 3.0

Moving to 3.0 as I don't think this is severe enough a bug to fix in a point release.

#2 @westi
6 years ago

Also to reproduce this you need a site with a single unpublished post so it is definitely not a serious issue.

#3 @westi
6 years ago

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

(In [12457]) Fix notice in get_boundary_post_rel_link when there is no post to link. Fixes #11490 props ShaneF.

#4 @dd32
6 years ago

  • Component changed from General to Warnings/Notices
Note: See TracTickets for help on using tickets.