Doc #64927 [Com]: realpath() still returns current path on Null/false argument
| From: | Sjon at hortensius dot net | Date: | Wed, 29 May 2013 18:47:20 +0000 |
| Subject: | Doc #64927 [Com]: realpath() still returns current path on Null/false argument | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9893@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64927&edit=1
ID: 64927
Comment by: Sjon at hortensius dot net
Reported by: myustc at 163 dot com
Summary: realpath() still returns current path on Null/false
argument
Status: Open
Type: Documentation Problem
Package: Filesystem function related
Operating System: Mac OS X 10.6.8
PHP Version: 5.3.25
Block user comment: N
Private report: N
New Comment:
It seems that Changelog notice is incorrect; see http://3v4l.org/MJUQe The only
difference is that since 5.2 the cwd is returned
Previous Comments:
------------------------------------------------------------------------
[2013-05-28 07:12:05] myustc at 163 dot com
Sorry, I meant the Changelog part:
-------------------
5.0.0 Prior to this release, a blank or NULL path would cause realpath() to return the directory
name of the script.
-------------------
which sounds to me as if such behavior was removed since 5.0.0. Correct me if I'm wrong...
------------------------------------------------------------------------
[2013-05-27 07:48:06] earlchaos at gmail dot com
I don't see the problem here?
From the manual:
path
The path being checked.
Note:
Whilst a path must be supplied, the value can be blank or NULL In these cases, the value is
interpreted as the current directory.
------------------------------------------------------------------------
[2013-05-27 07:42:13] myustc at 163 dot com
Description:
------------
---
From manual page: http://www.php.net/function.realpath#refsect1-function.realpath-changelog
---
I'm using PHP 5.3.15 (cli) (built: Jul 31 2012 18:42:11).
When I'm tracking a bug in Yii, I realized that it's the issue of php function realpath().
the reproducing is very easy, just run this in console:
php -r "var_dump(realpath(false), realpath(null), realpath(''));"
Test script:
---------------
<?php
var_dump(realpath(false));
var_dump(realpath(null));
var_dump(realpath(''));
Expected result:
----------------
I should see output as below:
bool(false)
bool(false)
bool(false)
Actual result:
--------------
output:(the actual path depends)
string(22) "/Users/yaowenh/phpunit"
string(22) "/Users/yaowenh/phpunit"
string(22) "/Users/yaowenh/phpunit"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64927&edit=1