(Sorry if this is titled poorly. I'm actually trying to accomplish two things - find out how the current directory can get changed in PHP, and fix a bug in Simpletest running on WAMP.)
I'm running SimpleTest (simpletest.org) on my Windows 7 local machine on EasyPHP (a WAMP variation).
When I run tests, the directory changes from the local script dir back to: C:\Program Files (x86)\EasyPHP\apache according to getcwd().
I created a couple short scripts to examine getcwd() output. They return the current script path as expected: C:\Users\Burton\Desktop\Sites\dbmover. The scripts:
serverpath/getcwd.php: <? echo getcwd(); require_once('tests/getcwd.php) ?>
serverpath/tests/getcwd.php: <? echo getcwd(); ?>
Both return the current path: C:\Users\Burton\Desktop\Sites\dbmover
I did a search through Simpletest source to check for use of chdir() and chroot() - the only ways. Simpletest doesn't use chdir();
What else could be changing the path??
This relative path problem is apparently very common for Simpletest used in Windows. This poster on stackoverflow has it, as does this poster elsewhere.
Some people treat the problem as normal, but I think it's a bug.
I've been getting around it myself by using dirname(__FILE__
) but I'd rather fix it to work correctly.