php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26640 __autoload() not invoked by Reflection classes
Submitted: 2003-12-16 13:19 UTC Modified: 2004-01-16 16:06 UTC
From: adam at trachtenberg dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-12-16 (dev) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adam at trachtenberg dot com
New email:
PHP Version: OS:

 

 [2003-12-16 13:19 UTC] adam at trachtenberg dot com
Description:
------------
The Reflection classes do not trigger __autoload() when 
the class is undefined. This works correctly for 
userland classes.

Reproduce code:
---------------
function __autoload($c) {
	class autoload_class {
		public function __construct() {
			print "autoload success\n";
		}
	}
}

Reflection:export(new Reflection_Class('autoload_class'));

Expected result:
----------------
autoload success
Class [ <user>  class autoload_class ] {
  @@ /Users/adam/Desktop/autoload.php 4-10

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [1] {
    Method [ <user> <ctor> public method __construct ] {
      @@ /Users/adam/Desktop/autoload.php 6 - 8
    }
  }
}

Actual result:
--------------
PHP Fatal error:  Uncaught exception 
'reflection_exception' with message 'Class 
autoload_class does not exist' in /Users/adam/Desktop/
autoload.php:10
Stack trace:
#0 {main}
  thrown in /Users/adam/Desktop/autoload.php on line 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-16 13:20 UTC] sniper@php.net
This should fix most of the cases:

  http://www.php.net/~jani/patches/bug26640.patch

If you find any other instances in the reflection classes,
do tell.. :)

 [2004-01-16 16:06 UTC] sniper@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 30 02:01:30 2025 UTC