#28566 [Opn->Asn]: __autoload does not work when called from a destructor
| From: | derick@php.net | Date: | Mon, 31 May 2004 10:04:57 +0000 |
| Subject: | #28566 [Opn->Asn]: __autoload does not work when called from a destructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60187@lists.php.net to get a copy of this message | ||
ID: 28566
Updated by: derick@php.net
Reported By: nick at 127tech dot net
-Status: Open
+Status: Assigned
Bug Type: Zend Engine 2 problem
Operating System: Debian Linux/2.6
PHP Version: 5.0.0RC2
-Assigned To:
+Assigned To: andi
New Comment:
Assigning to Andi, but I'm not sure whether this is a "feature request"
or a bug.
Previous Comments:
------------------------------------------------------------------------
[2004-05-29 03:53:01] nick at 127tech dot net
Description:
------------
If I define a destructor that needs __autoload to be
called, the require_once call inside of __autoload fails.
If I take the code that failed in the destructor and test
it in another function in the same class, the __autoload
call works fine.
I've noticed that the current working directory is not
correctly set when __autoload is called from the
destructor. It's set to "/", where as my other accesses to
__autoload have a working directory of where my scripts are
located.
I've checked and the file __autoload is trying to
require_once does exist. But even if I set the
full path for the require_once, __autoload fails to work
when called from the destructor.
Explicitly requiring the file with the external class or
causing __autoload to require that class before the
destructor cures the error.
my include_path is set to ".:/usr/local/lib/php". I've
tried placing a copy of my class files in
"/usr/local/lib/php", but that produces the same results.
thanks,
nick
Reproduce code:
---------------
function __autoload( $class )
{
require_once( $class.".php" );
}
class Blah
{
function __destruct()
{
$test = new OutsideClass();
}
}
$inst = new Blah;
Expected result:
----------------
//no output
Actual result:
--------------
Fatal error: __autoload() [function.require]: Failed
opening required 'OutsideClass.php'
(include_path='.:/usr/local/lib/php')
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28566&edit=1