From: roland at inkoeln dot com
Operating system: Linux
PHP version: 4.3.3
PHP Bug Type: Variables related
Bug description: Call-time pass-by-reference has been deprecated but without it it's impossible to pass a object-reference via call_user_function

You *must* use Call-time pass-by-reference to pass a
object-reference when using call_user_function.

In the example changeA() is declared to use passing
by reference but it still doesn't work. I think
call_user_function should either try to discover if it's
passing by reference at runtime or just pass always by

Reproduce code:

class A {
var $_id = 'A';

function printID() {
print "A::id=[".$this->_id."]\n";

function remote(&$obj_ref, $obj_method) {
call_user_func(array(&$obj_ref, $obj_method), $this);
// this on works:
// call_user_func(array(&$obj_ref, $obj_method),&$this);

class B {
function changeA(&$obj) {
$obj->_id = 'B';

$a = new A();
$b = new B();
$a->remote($b, 'changeA');


Expected result:

Actual result:

Edit bug report at [url][/url]
Try a CVS snapshot (php4): [url][/url]
Try a CVS snapshot (php5): [url][/url]
Fixed in CVS: [url][/url]
Fixed in release: [url][/url]
Need backtrace: [url][/url]
Try newer version: [url][/url]
Not developer issue: [url][/url]
Expected behavior: [url][/url]
Not enough info: [url][/url]
Submitted twice: [url][/url]
register_globals: [url][/url]
PHP 3 support discontinued: [url][/url]
Daylight Savings: [url][/url]
IIS Stability: [url][/url]
Install GNU Sed: [url][/url]