From:             webmaster at eiscp dot de
Operating system: Windows XP Professional SP 3
PHP version:      5.2.6
PHP Bug Type:     Class/Object related
Bug description:  __autoload tries to load callback'ed self and parent (close 
to #37138; no dupe)

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 bug report at http://bugs.php.net/?id=45214&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45214&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45214&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45214&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45214&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45214&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45214&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45214&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45214&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45214&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45214&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45214&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45214&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45214&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45214&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45214&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45214&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45214&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45214&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45214&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45214&r=mysqlcfg

Reply via email to