ID: 24420 Updated by: [EMAIL PROTECTED] Reported By: S dot Bennett at lancaster dot ac dot uk -Status: Open +Status: Feedback Bug Type: Directory function related Operating System: Linux PHP Version: 4.3.2 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Previous Comments: ------------------------------------------------------------------------ [2003-08-03 19:17:22] aredridel at nbtsc dot org I think I'm experiencing this or a related bug: I've a page that most of the time works fine, but about 10% of the time, the require() statement at the top doesn't find the file, which is in the same directory as the script and referenced with a simple relative path -- require('filename.inc') ------------------------------------------------------------------------ [2003-06-30 13:44:17] S dot Bennett at lancaster dot ac dot uk Description: ------------ The current working directory seems to set to random values under certain circumstances. e.g. getcwd() returns inconsistent values (as shown in the sample code) and attempts to reference files by relative paths work intermittently or not at all (which is how I discovered this bug..). Other variations on this code (eg calling getcwd() from an ob_start() callback) appear to give similar results. The code works fine from the command line (ie produces the expected result). I've configured PHP with the following, and still been able to reproduce the result: ./configure --prefix=/usr/local/packages/php-4.3.2 --with-apxs=/usr/local/packages/apache-1.3.27/bin/apxs I've also reproduced this problem on a Solaris box, also running Apache 1.3.27. Reproduce code: --------------- <?PHP print "current time is '".strftime("%D %T")."'<br>\n"; print "(in main) cwd is '".getcwd()."'<br>\n"; register_shutdown_function("atexit"); function atexit() { print "(in callback) cwd is '".getcwd()."'<br>\n"; } ?> Expected result: ---------------- Something like: current time is '06/30/03 18:39:24' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/steveb/public_html/callbacktest' Actual result: -------------- actual results vary, here's two. All I did in between them was press 'reload'... output 1: --------- current time is '06/30/03 18:59:24' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/www/vhosts/nutter.spoo.org/htdocs' output 2: --------- current time is '06/30/03 18:59:34' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/steveb/public_html' The values returned by getcwd() appear to be related to previous pages that have been served by apache (not necessarily ones that have been processed by PHP). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24420&edit=1