What do you get for ...
| From: | Richard Quadling | Date: | Tue, 07 Jun 2011 10:35:06 +0000 |
| Subject: | What do you get for ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-313427@lists.php.net to get a copy of this message | ||
Hi.
What do you get for ...
php -r "var_dump(realpath(null));"
I'm wondering if the result should be a boolean false.
But I'm getting very different results for different versions of PHP
for Windows.
For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd()
For PHP4, some very interesting differences ...
V4.0.0 : string(5) "Z:\\/"
V4.0.1 : string(5) "z:\\/"
V4.0.1pl1 : string(5) "z:\\/"
V4.0.2 : bool(false)
V4.0.3 : bool(false)
V4.0.4 : string(3) "z:\"
V4.0.4pl1 : string(3) "z:\"
V4.0.5 : string(3) "z:\"
V4.0.6 : string(3) "z:\"
V4.1.0 : string(3) "z:\"
V4.1.1 : string(3) "z:\"
V4.1.2 : string(3) "z:\"
V4.2.0 : string(98) "D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.2.x\php-4.2.0"
V4.2.1 : string(3) "z:\"
V4.2.2 : string(3) "z:\"
V4.2.3 : string(3) "z:\"
V4.2.3RC1 : string(3) "z:\"
V4.2.3RC2 : string(3) "z:\"
V4.3.0 : string(3) "z:\"
V4.3.0pre2 : string(102) "D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0pre2"
V4.3.0RC1 : string(101) "D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC1"
V4.3.0RC2 : string(101) "D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC2"
V4.3.0RC3 : string(101) "D:\Personal
Files\Downloads\Software\Programming\PHP\Official
Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC3"
V4.3.0RC4 : string(3) "z:\"
V4.3.1 : string(3) "z:\"
V4.3.10 : string(3) "z:\"
V4.3.11 : string(3) "z:\"
V4.3.2 : string(3) "z:\"
V4.3.2RC1 : string(3) "z:\"
V4.3.2RC2 : string(3) "z:\"
V4.3.2RC3 : string(3) "z:\"
V4.3.3 : string(3) "z:\"
V4.3.3RC1 : string(3) "z:\"
V4.3.3RC2 : string(3) "z:\"
V4.3.3RC3 : string(3) "z:\"
V4.3.3RC4 : string(3) "z:\"
V4.3.4 : string(3) "z:\"
V4.3.4RC1 : string(3) "z:\"
V4.3.4RC2 : string(3) "z:\"
V4.3.4RC3 : string(3) "z:\"
V4.3.5 : string(3) "z:\"
V4.3.5RC1 : string(3) "z:\"
V4.3.5RC2 : string(3) "z:\"
V4.3.5RC3 : string(3) "z:\"
V4.3.5RC4 : string(3) "z:\"
V4.3.6 : string(3) "z:\"
V4.3.6RC1 : string(3) "z:\"
V4.3.6RC2 : string(3) "z:\"
V4.3.6RC3 : string(3) "z:\"
V4.3.7 : string(3) "z:\"
V4.3.7RC1 : string(3) "z:\"
V4.3.8 : string(3) "z:\"
V4.3.9 : string(3) "z:\"
V4.3.9RC1 : string(3) "z:\"
V4.4.0 : string(3) "z:\"
V4.4.1 : string(3) "z:\"
V4.4.2 : string(3) "z:\"
V4.4.3 : string(3) "z:\"
V4.4.4 : string(3) "z:\"
V4.4.5 : string(3) "z:\"
V4.4.6 : string(3) "z:\"
V4.4.7 : string(3) "z:\"
V4.4.8 : string(3) "z:\"
V4.4.9 : string(3) "z:\"
Z:\ is essentially the equivalent of __DIR__ in this example.
What output do you get on non Windows setups?
php -r "var_dump(realpath(null));"
If the current releases on other OS's all have output equivalent to
getcwd(), then I'll change the documentation to at least mention that
a null or empty path equates to the current working directory for V5+.
Richard.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea