|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29268 __autoload() not called with reflectionProperty->getClass()
Submitted: 2004-07-19 23:12 UTC Modified: 2005-10-21 10:04 UTC
Avg. Score:4.2 ± 1.0
Reproduced:4 of 5 (80.0%)
Same Version:0 (0.0%)
Same OS:1 (25.0%)
From: david at jool dot nl Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.0 OS: winXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david at jool dot nl
New email:
PHP Version: OS:


 [2004-07-19 23:12 UTC] david at jool dot nl
When creating a new instance of a class inside eval() the __autoload function isn't called.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-15 17:21 UTC] david at jool dot nl
I took another look at the bug and found out it's more a reflectionProperty bug:

-- File 'A.class.php'
class A{	

-- File test.php in the same directory
/** autoload functie voor PHP5 */
function __autoload($classname) {
//When you include the following line, it works

class B{
	public function doit(A $a){

$ref = new reflectionMethod('B','doit');
$parameters = $ref->getParameters();	
foreach($parameters as $parameter){
	//the following line give the error
	$class = $parameter->getClass();	
	echo $class->name;

--Expected result

-- Actual result
Fatal error: Uncaught exception 'ReflectionException' with message 'Class A does not exist'
 [2005-01-15 17:59 UTC] david at jool dot nl
A possible solution might be to also check if zend_fetch_class() also returns null, next to zend_hash_find().

I'm not able to compile it myself, but the fix might be to change line 1703 in zend_reflection_api.c from
		if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {


		if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE
			&& zend_fetch_class(lcname, (param->arg_info->class_name_len + 1), ZEND_FETCH_CLASS_AUTO TSRMLS_CC) == NULL) {
 [2005-03-06 20:51 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-03-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-10-12 05:33 UTC] php at mfn dot de
I still encounter this bug in PHP 5.1.0RC1 on Win2k, also in  snapshot from Oct 12, 2005 02:30 GMT.
Here's a shorter reproduce code:

function foo(Bar $bar) {}

function __autoload($c) {
	class bar {}

$RF = new ReflectionFunction('foo');
foreach($RF->getParameters() as $param) {
 [2005-10-21 01:26 UTC] david at jool dot nl
Still not fixed. tested with latest CVS
 [2005-10-21 10:04 UTC]
Fixed in CVS HEAD and PHP_5_1.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Mar 04 13:01:25 2021 UTC