PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » Auth » Bug #9241

call_user_func_array: $this instaed of &$this

Details

Submitted2006-11-06 11:14 UTC
Fromjoliver at gmx dot at
Assignedaashley
StatusClosed
PackageAuth
PHP Version4.3.10
OSDebian stable
Roadmaps(Not assigned)

Comments

[2006-11-06 11:14 UTC] joliver at gmx dot at

Description:
------------
Auth.class, row 494:

in call_user_func_array, the array of parameters contain
$this as reference to the auth object.

however this only works with php5, because in php4 a copy
of the object is passed instead of the pointer.

the correct solution would be
call_user_func_array($this->loginCallback,
array($this->username, &$this));

the code contains lots of similar lines, i would suggest
to replace $this with &$this everywhere.

Test script:
---------------
Auth.class, row 494:

call_user_func_array('additionalChecks', array($this->username, &$this));

function additionalChecks($username, &$auth)
{
if ($username == 'test') {
$auth->logout();
}
}

Expected result:
----------------
In Auth.php $this->username should be empty, because of
logout(); So later it should call loginFunction again.

This only works in php5 or if &$this is passed to the
array function in call_user_func_array

[2006-11-10 01:12 UTC] aashley at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.