#22132 [Opn->Fbk]: getcwd() returns the wrong cwd in output handler function
| From: | iliaa@php.net | Date: | Thu, 13 Feb 2003 13:50:57 +0000 |
| Subject: | #22132 [Opn->Fbk]: getcwd() returns the wrong cwd in output handler function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33023@lists.php.net to get a copy of this message | ||
ID: 22132
Updated by: iliaa@php.net
Reported By: adam@adammckaig.com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: Windows 2000
PHP Version: 4.3.0
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
Cannot replicate using the latest CVS snapshot.
Previous Comments:
------------------------------------------------------------------------
[2003-02-08 23:00:43] adam@adammckaig.com
when getcwd() is called from within an output handler function, it
returns an incorrect path. the path returned is valid, and seems to be
a previously used working directory.
the following script demonstrates the problem:
<?
header( "content-type: text/plain\n\n" );
chdir( "c:\\" );
function output_handler( $ob ) {
//chdir( "d:\\" );
$ob .= "2 - ".getcwd()."\n";
return $ob;
}
ob_start( "output_handler" );
print "1 - ".getcwd()."\n";
?>
the output from this script is:
1 - c:\
2 - c:\www\wwwroot\adammckaig.com
the second directory is valid, but totally unrelated to the demo
script. the real oddity is that when the chdir( "d:\\" ); line is
un-remmed, it works as expected:
1 - c:\
2 - d:\
but rem out the line again, and the output remains the same - but only
for a minute or so! after about a minute, it has reset to the previous
directory, c:\www\wwwroot\adammckaig.com! odd indeed.
i've tried the test script out on freebsd and linux web-servers, which
both return the expected:
1 - /home/a/d/adammckaig/public_html/dev
2 - /home/a/d/adammckaig/public_html/dev
so the problem looks to be isolated to windows.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22132&edit=1