#50371 [NEW]: realpath() returns path to nonexistent file/folder
| From: | max at kosyakov dot net | Date: | Thu, 03 Dec 2009 12:08:42 +0000 |
| Subject: | #50371 [NEW]: realpath() returns path to nonexistent file/folder | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-145363@lists.php.net to get a copy of this message | ||
From: max at kosyakov dot net
Operating system: FreeBSD
PHP version: 5.2.11
PHP Bug Type: Filesystem function related
Bug description: realpath() returns path to nonexistent file/folder
Description:
------------
realpath() returns path for the folder that does not exists.
First appeared on php-5.2.8 on FreeBSD 6.1. I have upgraded to php-5.2.1,
however the bug persisted
%php -r '$test = "asdfasdf"; var_dump(realpath($test));
var_dump(file_exists(realpath($test)));'
string(27) "/usr/home/kosyakov/asdfasdf"
bool(false)
%php -v
PHP 5.2.11 (cli) (built: Dec 3 2009 17:26:14)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with the ionCube PHP Loader v3.1.32, Copyright (c) 2002-2007, by
ionCube Ltd.
%uname -imprsv
FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006
root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 i386
GENERIC
%more /usr/soft/php-5.2.11/config.nice
#! /bin/sh
#
# Created by configure
'./configure' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-mysql=/usr/local/mysql' \
'--with-config-file-path=/usr/local/apache2/conf' \
'--with-gd' \
'--with-png-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-freetype-dir=/usr/local' \
'--with-zlib-dir=/usr' \
'--with-iconv=/usr/local' \
'--enable-ftp' \
'--with-curl=/usr/local' \
'--with-openssl' \
'--enable-soap' \
'--with-pdo-mysql=/usr/local/mysql' \
'--with-mime-magic' \
'--enable-mbstring' \
'--without-sqlite' \
'--with-pdo-sqlite=/usr/local' \
'--enable-bcmath' \
"$@"
Bugs #43060 and #32627 look like the same bug but it is still
reproducible.
Reproduce code:
---------------
---
From manual page: function.realpath#Description
---
$test = "asdfasdf";
var_dump(realpath($test));
var_dump(file_exists(realpath($test)));'
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
string(27) "/usr/home/kosyakov/asdfasdf"
bool(false)
--
Edit bug report at http://bugs.php.net/?id=50371&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50371&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50371&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50371&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50371&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50371&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50371&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50371&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50371&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50371&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50371&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50371&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50371&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50371&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50371&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50371&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50371&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50371&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50371&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50371&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50371&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50371&r=mysqlcfg