#24420 [Opn->Fbk]: getcwd() returns random results in a callback
| From: | sniper@php.net | Date: | Tue, 19 Aug 2003 09:08:28 +0000 |
| Subject: | #24420 [Opn->Fbk]: getcwd() returns random results in a callback | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46185@lists.php.net to get a copy of this message | ||
ID: 24420
Updated by: sniper@php.net
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.3RC5-dev
New Comment:
I can not reproduce this. Do you possibly have some php ini-settings
set in your virtualhosts/some .htaccess file?
(using php_value or php_admin_value)
Previous Comments:
------------------------------------------------------------------------
[2003-08-19 03:50:32] S dot Bennett at lancaster dot ac dot uk
Tested this against the latest snapshot (200308190730, which describes
itself as 4.3.3RC5-dev) it's still behaving as I described.
------------------------------------------------------------------------
[2003-08-14 00:36:06] sniper@php.net
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
------------------------------------------------------------------------
[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