Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#20039 closed defect (bug) (fixed)

parse_query attempts to assign a non-variable by reference

Reported by: lgladdy's profile lgladdy Owned by: nacin's profile 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 13 years ago.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
13 years ago

  • Milestone changed from Awaiting Review to 3.4

#2 @duck_
13 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?

#3 @SergeyBiryukov
13 years ago

  • Keywords has-patch added

#4 @nacin
13 years ago

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

#5 @nacin
13 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.