Doc #64927 [PATCH]: realpath() still returns current path on Null/false argument

From: Date: Thu, 23 Apr 2015 21:13:57 +0000
Subject: Doc #64927 [PATCH]: realpath() still returns current path on Null/false argument
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12248@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
 Patch added by:     cmb@php.net
 Reported by:        myustc at 163 dot com
 Summary:            realpath() still returns current path on Null/false
                     argument
 Status:             Verified
 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:

The following patch has been added/updated:

Patch Name: changelog
Revision:   1429823637
URL:        https://bugs.php.net/patch-display.php?bug=64927&patch=changelog&revision=1429823637


Previous Comments:
------------------------------------------------------------------------
[2015-04-23 21:13:45] cmb@php.net

The PHP 5.0.0 changelog entry has been removed in the meantime. However, the behavioral change in
PHP 5.2.1 pointed out by Sjon is not yet documented.

------------------------------------------------------------------------
[2013-05-29 18:47:20] Sjon at hortensius dot net

It seems that Changelog notice is incorrect; see http://3v4l.org/MJUQe The only 
difference is that since 5.2 the cwd is returned

------------------------------------------------------------------------
[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


Thread (7 messages)

« previous php.doc.bugs (#12248) next »