From: csaba at alum dot mit dot edu Operating system: Windows - all PHP version: 5CVS-2004-05-03 (dev) PHP Bug Type: Directory function related Bug description: Realpath, getcwd not returning true pathname
Description: ------------ I am resubmitting this bug report (#17822) since the previous report seems to have been corrupted and all the developer comments gone missing! The bug is still there, too: [18 Jun 2002 6:20pm CEST] csaba at alum dot mit dot edu realpath and getcwd on Windows systems do not actually report the applicable directory, but rather a string that will !strcasecmp() with the true directory: I have a directory name, $dir, on my Win2K system (PHP 4.2.0), but it's in all lower case, and I'd like to get the actual pathname including the capitalizations: Both realpath() and dirname() only muck around with the $dir string and don't hit the file system. Not only that, but getcwd() returns $dir (sans capitalizations) after I've hopped over to it with chdir($dir)! My only solution to this point is to pop up a level and use readdir(...) but this is wasteful, only giving me one level at a time. Isn't there a REAL realpath() for windows? Thanks, Csaba Gabor [27 Jul 2002 11:45am CEST] [EMAIL PROTECTED] Looked into this, it looks possible to implement. Wish me luck :) [10 Oct 2002 10:47pm CEST] [EMAIL PROTECTED] Any news? [27 Oct 2002 7:27pm CET] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. [15 Feb 2003 5:38pm CET] csaba at alum dot mit dot edu I have marked this bug as open because of the demonstration below on my PHP 4.3 build date Dec. 20, 2002; Apache 2.0.43 Filter; Win2K Pro system. Here is the test: <html><head><title>getcwd Problem</title></head><body> <?php $cwd = getcwd(); chdir (strtolower($cwd)); print "<br>" . getcwd(); print "<br>" . realpath(getcwd()); chdir (strtoupper($cwd)); print "<br>" . getcwd(); print "<br>" . realpath(getcwd()); ?> </body></html> On my system the first 2 directories show in lower case, the last two are in caps. Csaba [15 Feb 2003 7:32pm CET] [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 latest CVS. [22 Feb 2003 8:03pm CET] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [23 Apr 12:26am CEST] csaba at alum dot mit dot edu I have tested this with the latest snapshot 5.0 RC 2 of April 22 on my Win 2K Pro system and it is still a problem. Here are the outputs that I get (I did an inititial print right after the first cwd() so you can see what windows thinks the directory is): C:\Morph\phpDev\40gNiKU5LQ0C c:\Morph\phpDev\40gniku5lq0c c:\Morph\phpDev\40gniku5lq0c C:\Morph\phpDev\40GNIKU5LQ0C C:\Morph\phpDev\40GNIKU5LQ0C So it appears that the middle part is OK but the drive letter and the final directory need some shoring up. Csaba Gabor Reproduce code: --------------- <html><head><title>getcwd Problem</title></head><body> <?php $cwd = getcwd(); print "$cwd<br>"; chdir (strtolower($cwd)); print "<br>" . getcwd(); print "<br>" . realpath(getcwd()); chdir (strtoupper($cwd)); print "<br><br>" . getcwd(); print "<br>" . realpath(getcwd()); ?> </body></html> -- Edit bug report at http://bugs.php.net/?id=28265&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28265&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28265&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28265&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28265&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28265&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28265&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28265&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28265&r=support Expected behavior: http://bugs.php.net/fix.php?id=28265&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28265&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28265&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28265&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28265&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28265&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28265&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28265&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28265&r=float