Bug #60940 [NEW]: SplFileInfo::getLinkTarget fails

From: Date: Tue, 31 Jan 2012 21:38:42 +0000
Subject: Bug #60940 [NEW]: SplFileInfo::getLinkTarget fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167016@lists.php.net to get a copy of this message
From:             
Operating system: Fedora 16
PHP version:      5.3SVN-2012-01-31 (snap)
Package:          SPL related
Bug Type:         Bug
Bug description:SplFileInfo::getLinkTarget fails

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 bug report at https://bugs.php.net/bug.php?id=60940&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=60940&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=60940&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=60940&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=60940&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60940&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=60940&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=60940&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=60940&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=60940&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=60940&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=60940&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=60940&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=60940&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=60940&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=60940&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60940&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=60940&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=60940&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=60940&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=60940&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=60940&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#167016) next »