﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses	prnumber
48312	PHP4 notation for passing object by reference broken	david.binda	SergeyBiryukov	"This is quite weird situation, since WordPress has already dropped support for PHP < 5.6.20, the r46149 is removing support for PHP 4 way of passing in object as references:

{{{#!php
if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) { // array(&$this) {
    $args[] =& $arg[0];
}
}}}

which may be breaking code, which works in PHP4 and due to the compat logic in do_action ( introduced in r4177 ), still works nowadays. Eg.:

{{{#!php
do_action( 'some_action', array( $this ) );
}}}

It's true that in PHP 5 all objects are being passed as references, so the array wrapping is no longer needed, but in case there is a code using the old notation (see above), the args are not really being passed to the callback in an expected way, eventually producing issues in the callbacks.

I'm attaching a phpunit test simulating the faulty behaviour, which was/is working before r46149."	defect (bug)	closed	normal	5.3	Plugins	5.3	normal	fixed	has-patch commit dev-reviewed			
