From: [EMAIL PROTECTED] Operating system: Windows 2000 PHP version: 4.3.0 PHP Bug Type: Output Control Bug description: getcwd() returns the wrong cwd in output handler function
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 bug report at http://bugs.php.net/?id=22132&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22132&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22132&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22132&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22132&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22132&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22132&r=support Expected behavior: http://bugs.php.net/fix.php?id=22132&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22132&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22132&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22132&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22132&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22132&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22132&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22132&r=gnused