WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#20039 closed defect (bug) (fixed)

parse_query attempts to assign a non-variable by reference

Reported by: lgladdy Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description

Line 1628 of query.php is currently:

$this->queried_object =& get_page_by_path($qv['pagename']);

This results in a PHP error of "Only variables should be assigned by reference", pulling the result of the get_page_by_path into a variable and referencing that works okay, but i'm not confident enough in that not breaking other things to submit it as a patch!

$path = get_page_by_path($qv['pagename']);
$this->queried_object =& $path;

Attachments (1)

20039.patch (965 bytes) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 SergeyBiryukov2 years ago

  • Milestone changed from Awaiting Review to 3.4

comment:2 duck_2 years ago

Related: http://lists.automattic.com/pipermail/wp-hackers/2010-October/035615.html, [16104], [18541].

So either the suggested fix or put back $null = null would probably do it.

Do we actually need =& any more?

SergeyBiryukov2 years ago

comment:3 SergeyBiryukov2 years ago

  • Keywords has-patch added

comment:4 nacin2 years ago

& is not necessary anymore. This is one of the few places with & when dealing with pages at this point.

comment:5 nacin2 years ago

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

In [20491]:

No need for by-reference when calculating the queried object in PHP5. props SergeyBiryukov, duck_, fixes #20039.

Note: See TracTickets for help on using tickets.