Bug #69339 [NEW]: realpath(false) returns CWD
| From: | sebastian@php.net | Date: | Tue, 31 Mar 2015 09:04:32 +0000 |
| Subject: | Bug #69339 [NEW]: realpath(false) returns CWD | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-191745@lists.php.net to get a copy of this message | ||
From: sebastian
Operating system: Linux
PHP version: 5.6.7
Package: Filesystem function related
Bug Type: Bug
Bug description:realpath(false) returns CWD
Description:
------------
realpath(false) returns the CWD. This is the behavior that the manual
describes for blank or NULL values: "Whilst a path must be supplied, the
value can be blank or NULL In these cases, the value is interpreted as
the current directory."
Either this is a bug in PHP or the documented needs to be amended.
Test script:
---------------
<?php
var_dump(realpath(false));
var_dump(realpath(true));
var_dump(realpath(0));
var_dump(realpath(null));
var_dump(realpath(''));
Expected result:
----------------
bool(false)
bool(false)
bool(false)
string(8) "/home/sb"
string(8) "/home/sb"
Actual result:
--------------
string(8) "/home/sb"
bool(false)
bool(false)
string(8) "/home/sb"
string(8) "/home/sb"
--
Edit bug report at https://bugs.php.net/bug.php?id=69339&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69339&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69339&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69339&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69339&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69339&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69339&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69339&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69339&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69339&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69339&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69339&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69339&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69339&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69339&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69339&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69339&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69339&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69339&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69339&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69339&r=mysqlcfg