|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43973 __autoload called with wrong classname when triggered by static callback
Submitted: 2008-01-29 18:28 UTC Modified: 2008-01-30 12:31 UTC
From: robin_fernandes at uk dot ibm dot com Assigned:
Status: Closed Package: Class/Object related
PHP Version: 6CVS-2008-01-29 (snap) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
1 + 19 = ?
Subscribe to this entry?

 [2008-01-29 18:28 UTC] robin_fernandes at uk dot ibm dot com
NB: This issue is specific to PHP6 snaps. PHP5.2 and PHP5.3 snaps produce the expected output.

When using a callback of the form 'C::f' where class C is not yet defined, __autoload() is invoked with the fully qualified method name as an argument, rather than just the class name.

Reproduce code:
function __autoload($name) {
  echo "Autoload class: $name\n";
  if ($name == 'C') {
    class C { static function f() {	echo "In C::f()\n";	} }


Expected result:
Autoload class: C
In C::f()

Actual result:
Autoload class: C::f

Warning: call_user_func() expects parameter 1 to be valid callback, string given in %s on line 9


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-30 12:31 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC