Bug #43977 [Bgs->Fbk]: chdir() not working with absolute path / CWD not properly reset

From: Date: Fri, 23 Jul 2010 17:41:57 +0000
Subject: Bug #43977 [Bgs->Fbk]: chdir() not working with absolute path / CWD not properly reset
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152688@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=43977&edit=1

 ID:               43977
 Updated by:       pajoye@php.net
 Reported by:      sysdev at gmx dot net
 Summary:          chdir() not working with absolute path / CWD not
                   properly reset
-Status:           Bogus
+Status:           Feedback
 Type:             Bug
 Package:          IIS related
 Operating System: Windows Server 2003
 PHP Version:      5.2.6

 New Comment:

@dscotese at litmocracy dot com

Please try using a recent PHP version and provide


Previous Comments:
------------------------------------------------------------------------
[2010-07-23 19:40:16] dscotese at litmocracy dot com

I am using XAMPP and I just got the "No error(errno 0)" error on an
attempt to change directory to /var/www/a_misspelled_dirname.  The error
should have been No such file or directory (errno 2).  I thought this
info might be useful, as I'm not using IIS at all.

PHP Version 5.2.5

System 	Windows NT DAVESTOSHIBA 5.1 build 2600
Build Date 	Nov 8 2007 23:18:08
Configure Command 	cscript /nologo configure.js
"--enable-snapshot-build" "--with-gd=shared"
Server API 	Apache 2.0 Handler
Virtual Directory Support 	enabled
Configuration File (php.ini) Path 	C:\WINDOWS
Loaded Configuration File 	C:\xampp\apache\bin\php.ini
PHP API 	20041225
PHP Extension 	20060613
Zend Extension 	220060519

------------------------------------------------------------------------
[2008-10-21 15:32:17] jani@php.net

We are aware of PHP's problems with stability under IIS and are working 
to rectify the problem. Unfortunatly your bug report does not contain
any
extra useful information and we already have enough bug reports open
about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.



------------------------------------------------------------------------
[2008-05-26 08:09:49] php5 dot 20 dot cheef-daniel at spamgoumet dot com

I checked it with php 5.2.5 and 5.2.6 + IIS + Win 2003 Server SP1.
Same error on both versions, I even can't include files because of
this.

include(config.php) [function.include]: failed to open stream: No such
file or directory

config.php is in the same directory and has same rights than the calling
index.php.

getcwd, placed on top of index.php shows me everytime I run this script
another dir out of the docroot. chdir(basename(__FILE__)) under/above
getcwd fails with error 0 like in this bugreport.

------------------------------------------------------------------------
[2008-01-29 21:49:37] sysdev at gmx dot net

Description:
------------
IIS 6 with PHP 5 SAPI:

In some cases, the CWD of a PHP-script run is not properly reset to the
script's directory. Its instead the directory of another previously run
script.

chdir() with an absulote path fails in these cases if the desired path
is no child of the script's path itself, while chdir() with a relative
path to the same destination succeedes.

Reproduce code:
---------------
Script located in d:\webshare\web3

echo '<div>CWD is '.getcwd().'</div>';
chdir( 'd:\\webshare\\web3' );
echo '<div>CWD is '.getcwd().'</div>';
chdir( 'd:\\webshare\\web3\\test' );
echo '<div>CWD is '.getcwd().'</div>';

Expected result:
----------------
Script located in d:\webshare\web3

CWD is 'd:\webshare\web3'
CWD is 'd:\webshare\web3'
CWD is 'd:\webshare\web3\test'

Actual result:
--------------
Script located in d:\webshare\web3

CWD is 'd:\webshare\another\scripts\path'
Warning: chdir() [function.chdir]: No such file or directory (errno 2)
in D:\webshare\web3\test.php on line 4
CWD is 'd:\webshare\another\scripts\path'
CWD is 'd:\webshare\web3\test'

-- or sometimes --

Script located in d:\webshare\web3

CWD is 'd:\webshare\another\scripts\path'
Warning: chdir() [function.chdir]: No error (errno 0) in
D:\webshare\web3\test.php on line 4
CWD is 'd:\webshare\another\scripts\path'
CWD is 'd:\webshare\web3\test'




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=43977&edit=1


Thread (8 messages)

« previous php.bugs (#152688) next »