I noticed my Autoloader was not working properly on destructors (after die;
), because PHP changes the current directory on shutting down.
was:
D:\www\arsenal
got changed to:
C:\wamp\bin\apache\Apache2.2.21
I don't even know why it does that. I solved the Autoloader problem using realpath
but was wondering what kind of other problems it may cause.
So, is it safe to use chdir
to change it back in a function registered with register_shutdown_function
? I tested it and totally solved the Autoloader problem, as well as realpath
did (the shutdown function gets called before the destructors, don't know why either).
The catch is that i'm afraid of the consequences. I don't even know if PHP behaves this way in other platforms. I would really like to have more information on the subject.
I'm on Windows 7, using WAMP 2.2 (PHP 5.3.8, Apache 2.2.21).