|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-31 12:04 UTC] derick@php.net
[2004-11-01 14:02 UTC] michali dot sarris at gmail dot com
[2005-04-25 15:17 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
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')