Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#25750 closed defect (bug) (fixed)

Regression in get_pages: hierarchical is disabled when using default arguments

Reported by: chrisjean Owned by: nacin
Priority: normal Milestone: 3.7.1
Component: Query Version: 3.7
Severity: major Keywords: has-patch commit
Cc: Focuses:

Description

With default arguments, get_pages has the following relevant arguments:

hierarchical: 1
parent: -1
child_of: 0

The 3.7 release included the following code:

if ( $parent && ! $child_of )
    $hierarchical = false;

This causes the default arguments listed above to change into:

hierarchical: false
parent: -1
child_of: 0

Thus, it is impossible to enable hierarchical if parent is set to -1, which it is by default.

Attachments (3)

25750.diff​ (418 bytes ) - added by chrisbliss18 13 years ago.
25750.1.test.diff​ (895 bytes ) - added by atimmer 13 years ago.
25750.2.diff​ (1.9 KB ) - added by nacin 13 years ago.

Download all attachments as: .zip

Change History (12)

@chrisbliss18
13 years ago

#1 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review → 3.7.1

Introduced in [25270].

#2 @nacin
13 years ago

  • Keywords needs-unit-tests added

Broken specifically in [25270], which was a follow-up to [25245]. See #25230.

#25230 really needed unit tests before [25245] landed. Let's make sure we have one here — that's very important.

#3 @atimmer
13 years ago

​25750.1.test.diff adds a test to test this behaviour.

@nacin
13 years ago

#4 @nacin
13 years ago

  • Keywords commit added; needs-unit-tests removed

#5 @valeriosza
13 years ago

  • Keywords close added

#6 @SergeyBiryukov
13 years ago

  • Keywords close removed

#7 @nacin
13 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → closed

In 25974:

Avoid resetting the 'hierarchical' argument in get_pages() when 'parent' is -1, the default.

Fixes a regression introduced in [25270]. Adds unit tests.

props chrisbliss18.
fixes #25750.

#8 @nacin
13 years ago

In 25975:

Move the unit test added in [25974] to the more appropriate file. see #25750.

#9 @nacin
13 years ago

In 25976:

Avoid resetting the 'hierarchical' argument in get_pages() when 'parent' is -1, the default.

Merges [25974] and [25975] to the 3.7 branch.

Fixes a regression introduced in [25270]. Adds unit tests.

props chrisbliss18.
fixes #25750.

Note: See TracTickets for help on using tickets.