php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41480 realpath returns false on valid path without filename
Submitted: 2007-05-24 02:13 UTC Modified: 2010-12-20 12:26 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: derek dot ethier at gmail dot com Assigned: dmitry (profile)
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.2 OS: Windows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: derek dot ethier at gmail dot com
New email:
PHP Version: OS:

 

 [2007-05-24 02:13 UTC] derek dot ethier at gmail dot com
Description:
------------
In PHP < 5.2.2 the realpath function would return a string value on a valid path passed to the function. In 5.2.2 it returns false unless a filename is specified.

Going over the documentation it looks like this might be an expected result, but it is different from earlier versions.

Extensions: curl, ldap, mssql, mysql, pdo, pdo_sqlite, pdo_mssql, sqlite, tidy, ssh2

I'm using the php.ini file from my 5.2.1 installation and going over the incompatibilities and changes from 5.2.1 the only change that seems related is this one:

- SplFileObject::getFilename() returns the filename, not relative/path/to/file, as of PHP 5.2.1.

Reproduce code:
---------------
$path1 = 'E:\\webroot\\';
$path2 = 'E:\\webroot\\index.php';

var_dump(realpath($path1));
var_dump(realpath($path2));

Expected result:
----------------
string 'E:\webroot\' (length=11)
string 'E:\webroot\index.php' (length=20)

Actual result:
--------------
boolean false
string 'E:\webroot\index.php' (length=20)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-01 16:48 UTC] derek dot ethier at gmail dot com
(This problem is still present in 5.2.3)

I don't think that this is the expected result for this function call as the posted expected result is returned with both the CGI module and with Apache2 on the same server. Only the ISAPI module returns the boolean false on a valid path without filename.
 [2007-06-14 10:26 UTC] dmitry@php.net
I am not able to reprodce this problem with CVS version.
 [2007-08-14 04:16 UTC] derek dot ethier at gmail dot com
This is still a problem with Windows Server 2003 pre-SP2. Once SP2 is installed it seems to fix it. So, my issue is solved but other people might experience it.
 [2007-08-14 04:17 UTC] derek dot ethier at gmail dot com
Also, using PHP 5.2.3 as well now.
 [2007-08-14 09:52 UTC] jani@php.net
Obviously it's a windows bug. Not PHP bug -> bogus.
 [2010-12-20 12:26 UTC] jani@php.net
-Package: Tidy +Package: Filesystem function related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC