Bug #60940 [Com]: SplFileInfo::getLinkTarget fails
Edit report at https://bugs.php.net/bug.php?id=60940&edit=1
ID: 60940
Comment by: php-dev at zerocue dot com
Reported by: aheadley at nexcess dot net
Summary: SplFileInfo::getLinkTarget fails
Status: Open
Type: Bug
Package: SPL related
Operating System: Fedora 16
PHP Version: 5.3SVN-2012-01-31 (snap)
Block user comment: N
Private report: N
New Comment:
Confirmed works in 5.4RC7 and trunk as well.
Previous Comments:
------------------------------------------------------------------------
[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)