PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #42038 realpath does not resolve symbolic link
Submitted:18 Jul 2007 5:16pm UTC Modified: 26 Aug 2008 11:02pm UTC
From:kraghuba at in dot ibm dot com Assigned to:fb-req-jani
Status:Bogus Category:Filesystem function related
Version:5CVS-2007-07-18 (snap) OS:MacOSX, FreeBSD
Votes:2 Avg. Score:3.0 ± 0.0 Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%) Same OS:1 (50.0%)
View/Vote Developer Edit Submission

[18 Jul 2007 5:16pm UTC] kraghuba at in dot ibm dot com
Description:
------------
realpath() doesn't resolve symlink and returns the link file name when
input path is a link path.

As per the documentation at
http://in.php.net/manual/en/function.realpath.php, The resulting path
will have no symbolic link, '/./' or '/../' components.

Applicable to php5.2.4 only on MacOS X.

Please check testcase symlink_link_linkinfo_is_link_variation6.phpt.

Reproduce code:
---------------
<?php
$file_path = dirname(__FILE__);
$filename = "$file_path/file.tmp";
$linkname = "$file_path/link.tmp";

$fp = fopen($filename, "w");
fclose($fp);

symlink($filename, $linkname); 
var_dump( realpath($linkname) );

unlink($linkname);
unlink($filename);
?>

Expected result:
----------------
string(%d) "%s/file.tmp"

Actual result:
--------------
string(%d) "%s/link.tmp"
[19 Jul 2007 3:21am UTC] kraghuba at in dot ibm dot com
The reference to testcase symlink_link_linkinfo_is_link_variation6.phpt
is wrong. The write testcases to check are :
ext/standard/tests/file/readlink_realpath_basic1.phpt
ext/standard/tests/file/readlink_realpath_variation1.phpt
ext/standard/tests/file/readlink_realpath_variation2.phpt

The similar failure is also noticed on FreeBSD.
(FreeBSD - FreeBSD lindsay.php.is 6.2-STABLE FreeBSD 6.2-STABLE #1: Thu
Jun 28 22:12:54 CEST 2007 )

MACOSX details:
Darwin - Darwin thought 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23
16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386
[12 Aug 2008 8:54am UTC] jani@php.net
I'm guessing this should be fixed in PHP_5_3 and HEAD by the commit by
Dmitry?
[18 Aug 2008 4:34am UTC] kraghuba at in dot ibm dot com
Hi Jani,

I do not MacOSX/FreeBSD system to verify this. If you know someone who
has, pls request for verfication. 

PS: When i raised this defect ,i used test run report sent by others
over the php-qa list.

with Regards,
Raghubansh
[26 Aug 2008 11:02pm UTC] jani@php.net
Don't open bug reports in behalf of anyone..

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC