Bug #60940 [Opn->Csd]: SplFileInfo::getLinkTarget fails
Edit report at https://bugs.php.net/bug.php?id=60940&edit=1
ID: 60940
Updated by: iliaa@php.net
Reported by: aheadley at nexcess dot net
Summary: SplFileInfo::getLinkTarget fails
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
Operating System: Fedora 16
PHP Version: 5.3SVN-2012-01-31 (snap)
-Assigned To:
+Assigned To: iliaa
Block user comment: N
Private report: N
New Comment:
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
Previous Comments:
------------------------------------------------------------------------
[2012-02-04 17:58:47] php-dev at zerocue dot com
Confirmed works in 5.4RC7 and trunk as well.
------------------------------------------------------------------------
[2012-01-31 21:57:58] aheadley at nexcess dot net
It also appears to be working in 5.4.0RC6.
------------------------------------------------------------------------
[2012-01-31 21:38:42] aheadley at nexcess dot net
Description:
------------
SplFileInfo::getLinkTarget (http://www.php.net/manual/en/splfileinfo.getlinktarget.php) does not
seem to work at all. It fails with a "Unable to read link <symlink name>, error: Invalid
argument" message. Reproduced on 5.3.8 and 5.3.10-dev snapshot (201201312030) but works on
5.2.17.
This similar but not quite the same as #51804 (https://bugs.php.net/bug.php?id=51804)
Test script:
---------------
touch('testfile');
symlink('testfile', 'testlink');
$f = new SplFileInfo( 'testlink' );
printf( 'readlink: %s'.PHP_EOL, readlink( $f->getPathname() ) );
printf( 'SplFileInfo::getLinkTarget: %s'.PHP_EOL, $f->getLinkTarget() );
Expected result:
----------------
readlink: testfile
SplFileInfo::getLinkTarget: testfile
Actual result:
--------------
readlink: testfile
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to read link
testlink, error: Invalid argument' in /home/aheadley/Desktop/testing/test.php:6
Stack trace:
#0 /home/aheadley/Desktop/testing/test.php(6): SplFileInfo->getLinkTarget()
#1 {main}
thrown in /home/aheadley/Desktop/testing/test.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60940&edit=1
Thread (4 messages)