[wp-trac] [WordPress Trac] #17670: PHP Notices from get_page_by_path()

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 28 10:25:56 UTC 2011


#17670: PHP Notices from get_page_by_path()
------------------------------------------------------+------------------
 Reporter:  dd32                                      |       Owner:
     Type:  defect (bug)                              |      Status:  new
 Priority:  normal                                    |   Milestone:  3.3
Component:  Warnings/Notices                          |     Version:  3.1
 Severity:  normal                                    |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-tests  |
------------------------------------------------------+------------------

Comment (by duck_):

 I was looking at the latest patch again and working through its logic when
 I noticed a major problem both with it and the current code in trunk.

 Create two similar hierarchies of pages, but with one missing the highest
 level page, e.g.

 {{{
 level-0 > level-1 > level-2

 level-1 > level-2
 }}}

 where > indicates "parent of". Make sure you give them content that you
 can distinguish them by, e.g. their slug and the slugs of their ancestors,
 and create them in the order displayed so that the deeper "level-2" has a
 lower ID.

 Now visit /level-1/level-2 and you will receive the wrong level-2 page.

 The problem currently in trunk is that when we try to lookup the parent of
 level-1 we get NULL as level-0 isn't in the array of pages, so the while
 loop (line 3171) stops and the if statement (line 3178) passes since the
 count is correct.

 17670.6.diff is broken in a similar way, but without the PHP notices.

 Attaching 17670.7.diff to check that we've reached the root of a tree of
 pages before accepting.

 I think that the issue raised in this comment is a blocker for release.
 This ticket should either be repurposed to reflect that or closed as dupe
 of a new ticket, any preferences?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17670#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list