ID: 28566 Comment by: michali dot sarris at gmail dot com Reported By: nick at 127tech dot net Status: Assigned Bug Type: Zend Engine 2 problem Operating System: Debian Linux/2.6 PHP Version: 5.0.0RC2 Assigned To: andi New Comment:
I am having the same problem. It sure does seem to be a bug since im sure it is not a feature request. I use a few classes to persist an object when it is new or modified. I save the actualy persisting operations for when the object is actualy no more needed. A good method to do this seemed my, was to put the final call in the destructor. But i got a few errors wich i couldn't understand at first. I tried to debug the __autoload method with some file_exist calls. For all the classes the file does exist, but when classes are loaded from a call from the destructor, then every file does not seem to exist, strangely. Can this be fixed please? Thanks. Previous Comments: ------------------------------------------------------------------------ [2004-05-31 12:04:56] [EMAIL PROTECTED] Assigning to Andi, but I'm not sure whether this is a "feature request" or a bug. ------------------------------------------------------------------------ [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