Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#25750 closed defect (bug) (fixed)

Regression in get_pages: hierarchical is disabled when using default arguments

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

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 11 years ago.
25750.1.test.diff (895 bytes) - added by atimmer 11 years ago.
25750.2.diff (1.9 KB) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (12)

@chrisbliss18
11 years ago

#1 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7.1

Introduced in [25270].

#2 @nacin
11 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
11 years ago

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

@nacin
11 years ago

#4 @nacin
11 years ago

  • Keywords commit added; needs-unit-tests removed

#5 @valeriosza
11 years ago

  • Keywords close added

#6 @SergeyBiryukov
11 years ago

  • Keywords close removed

#7 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to 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
11 years ago

In 25975:

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

#9 @nacin
11 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.