Edit report at https://bugs.php.net/bug.php?id=61766&edit=1

 ID:                 61766
 Updated by:         ahar...@php.net
 Reported by:        admin dot windows at gmail dot com
 Summary:            call_user_func sends scrambled class name to
                     autoload
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   ALL
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

I can't reproduce this.

What extensions do you have enabled?


Previous Comments:
------------------------------------------------------------------------
[2012-04-18 15:19:23] admin dot windows at gmail dot com

Description:
------------
I have discovered weird behaviour of call_user_func that breaks class 
autoloader by providing scrambled class name for example instead of "myObject" 
it provides "zw87zl18".
This event only occurs if you are using custom class autoloader and requesting 
static method that is not declared as static.

Test script:
---------------
//FILE: myObject.php
class myObject {
    public static function method1(){var_dump(__METHOD__);}
    public function method2(){var_dump(__METHOD__);}
}

//FILE: index.php
ini_set('display_errors', TRUE);

function __autoload($className) {
   include sprintf('%s/%s.php', getcwd(), $className);
}

call_user_func(array('myObject', 'method1'));//works fine

call_user_func(array('myObject', 'method2'));//produce an error

Expected result:
----------------
string(17) "myObject::method1"
string(17) "myObject::method2"

Actual result:
--------------
string(17) "myObject::method1"
Warning: include(/www/zw87zl18.php) [function.include]: failed to open stream: 
No such file or directory in /www/index.php on line 9

Warning: include() [function.include]: Failed opening '/www/zw87zl18.php' for 
inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /www/index.php 
on line 9

Warning: include(/www/zw87zl18.php) [function.include]: failed to open stream: 
No such file or directory in /www/index.php on line 9

Warning: include() [function.include]: Failed opening '/www/zw87zl18.php' for 
inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /www/index.php 
on line 9
string(17) "myObject::method2" 


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61766&edit=1

Reply via email to