Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#28739 closed defect (bug) (fixed)

r28523 __call() some functions expecting params by reference

Reported by: sboisvert's profile sboisvert Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Query Keywords:
Focuses: Cc:


Given this code:


you will get:
Warning: Parameter 1 to WP_Query::parse_tax_query() expected to be a reference, value given is an example of where this code is used.

changing parse_tax_query()'s declaration to public fixes this.

This was introduced in r28523

Change History (4)

#1 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.0

#2 @wonderboymusic
10 years ago

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

In 28987:

WP_Query::parse_tax_query() has always been documented as protected. Plugins should never have used it. However, it did not have a protected access modifier, so its visibility was public by default. If the access modifier had been present, accessing the method in a plugin would have produced a fatal error. The access modifier was added in [28523], along with magic methods to allow it to be accessed for BC. This one method is problematic because it expects to be passed a reference. The WP_Query::__call() logic does not go out of its way to fix this signature discrepancy, and so a warning is thrown: Parameter 1 to WP_Query::parse_tax_query() expected to be a reference, value given.

Remove the protected access modifier from WP_Query::parse_tax_query().

Fixes #28739.

#3 @nacin
9 years ago

In 29658:

Query: Add comment to the parse_tax_query() method reflecting [28987].

see #28739.

#4 @nacin
9 years ago

[28987] is a great commit message, just wanted to make sure someone would find it again in the future.

Note: See TracTickets for help on using tickets.