ID: 45214
Updated by: [EMAIL PROTECTED]
Reported By: webmaster at eiscp dot de
-Status: Open
+Status: Wont fix
Bug Type: Class/Object related
Operating System: Windows XP Professional SP 3
PHP Version: 5.2.6
New Comment:
Fixed in HEAD/5.3, wont fix elsewhere.
Previous Comments:
------------------------------------------------------------------------
[2008-06-09 13:34:35] webmaster at eiscp dot de
Description:
------------
Like #37138 __autoload tries to load callback'ed self and parent PHP
tries to __autoload if callcack is used with self or parent in method
name. Please note that this is not a dupe!
Reproduce code:
---------------
function __autoload($class) {
echo __METHOD__, '(', $class, ')', PHP_EOL;
}
class A {
function X() {
echo __METHOD__, PHP_EOL;
}
function Y() {
echo __METHOD__, PHP_EOL;
call_user_func(array($this, 'self::X'));
}
}
class B extends A {
function X() {
echo __METHOD__, PHP_EOL;
call_user_func(array($this, 'parent::X'));
}
function Y() {
echo __METHOD__, PHP_EOL;
call_user_func(array($this, 'parent::Y'));
}
}
// Test
$a = new A();
echo '--- Case 1 ---', PHP_EOL;
$a->X();
echo '--- Case 2 ---', PHP_EOL;
$a->Y();
$b = new B();
echo '--- Case 3 ---', PHP_EOL;
$b->X();
echo '--- Case 4 ---', PHP_EOL;
$b->Y();
Expected result:
----------------
--- Case 1 ---
A::X
--- Case 2 ---
A::Y
A::X
--- Case 3 ---
B::X
A::X
--- Case 4 ---
B::Y
A::Y
A::X
Actual result:
--------------
--- Case 1 ---
A::X
--- Case 2 ---
A::Y
__autoload(self)
A::X
--- Case 3 ---
B::X
__autoload(parent)
A::X
--- Case 4 ---
B::Y
__autoload(parent)
A::Y
__autoload(self)
A::X
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45214&edit=1