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

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

 New Comment:

Hi,
I have following extensions enabled on my hosting (Rackspace):

Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, 
hash, filter, ftp, gettext, gmp, SPL, iconv, Reflection, session, standard, 
shmop, SimpleXML, sockets, exif, tokenizer, xml, apache2handler, bcmath, curl, 
dba, dom, fileinfo, gd, imagick, imap, intl, json, ldap, pdf, mbstring, mcrypt, 
memcache, mongo, mssql, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, 
PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, recode, redis, 
snmp, soap, sysvmsg, sysvsem, sysvshm, tidy, uploadprogress, wddx, xmlreader, 
xmlrpc, xmlwriter, xsl, yaz, zip, ionCube Loader, Zend Guard Loader, XCache


Previous Comments:
------------------------------------------------------------------------
[2012-04-19 07:07:33] ahar...@php.net

I can't reproduce this.

What extensions do you have enabled?

------------------------------------------------------------------------
[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