#17822 [Opn->Csd]: Realpath, getcwd not returning true pathname
| From: | csaba at alum dot mit dot edu | Date: | Fri, 09 Feb 2007 10:23:06 +0000 |
| Subject: | #17822 [Opn->Csd]: Realpath, getcwd not returning true pathname | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108620@lists.php.net to get a copy of this message | ||
ID: 17822
User updated by: csaba at alum dot mit dot edu
Reported By: csaba at alum dot mit dot edu
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Windows - all
PHP Version: 4.3.0
Assigned To: sfox
New Comment:
Hurrah! This now appears fixed.
realpath(strtolower(getcwd())) is now the same as
realpath(strtoupper(getcwd())) is now the same as
getcwd()
on my Win XP Pro under
PHP 5.2.1RC4-dev (cli) (built: Jan 25 2007 08:24:12)
Thanks,
Csaba Gabor from Vienna
Previous Comments:
------------------------------------------------------------------------
[2004-04-23 00:26:09] 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
------------------------------------------------------------------------
[2003-02-15 17:38:53] 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
------------------------------------------------------------------------
[2002-06-18 18:20:36] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17822&edit=1