ID: 22132
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Feedback
+Status: Open
Bug Type: Output Control
Operating System: Windows 2000
PHP Version: 4.3.0
New Comment:
the cvs snapshot has the same behaviour. after a bit more poking, i've
found that the "register_shutdown_function" does the same thing. my
slightly expanded test script:
<?
chdir( "c:\\' );
function output_handler( $ob ) {
$ob .= "2 - ".getcwd()."<br />\n";
return $ob;
}
function shutdown_function() {
print "3 - ".getcwd()."<br />\n";
}
ob_start( "output_handler" );
register_shutdown_function( "shutdown_function" );
print "1 - ".getcwd()."<br />\n";
?>
now outputs:
1 - c:\
2 - d:\program files\apache
3 - d:\program files\apache
the paths returned are different from my first example, because the
script was tested straight after restarting apache. if i execute some
other scripts that changed the chdir, then execute the test script, the
results are the same as my first example.
Previous Comments:
------------------------------------------------------------------------
[2003-02-13 07:50:57] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[2003-02-08 23:00:43] [EMAIL PROTECTED]
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