php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51766 SplFileInfo::isLink() Fails for Symlinks on windows
Submitted: 2010-05-07 19:08 UTC Modified: 2010-09-01 12:12 UTC
From: v-sumada at microsoft dot com Assigned: pajoye (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.2 OS: All Windows OS
Private report: No CVE-ID: None
 [2010-05-07 19:08 UTC] v-sumada at microsoft dot com
Description:
------------
SplFileInfo::isLink()  Which returns False for Symbolic links on all  windows OS. we have a  File Symbolic link created  for a file and tried to test whether the referenced file  by SplFileInfo is symbolic link or not.


In the above script we have a symlink(filesymlink)created for a file 'testfile'  and tried to check with the file_exists function for symlink(filesymlink) which returns true and it returns false for the SplFileInfo::isLink().



Test script:
---------------
<?php
$symlinkname = "/path/to/filesymlink";
$fileinfo = new SplFileInfo($symlinkname);
var_dump(file_exists($symlinkname));
var_dump($fileinfo->isLink());
?>

Expected result:
----------------
bool(true)
bool(true)

Actual result:
--------------
bool(true)
bool(false)

Patches

add_lstat_support (last revision 2010-08-31 08:53 UTC by pajoye@php.net)
lstat-support-1 (last revision 2010-08-30 17:48 UTC by pajoye@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-07 01:56 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pajoye
 [2010-08-07 01:56 UTC] johannes@php.net
Pierre, I think you played with symlinks on Windows before, can you add the magic needed, here?
 [2010-08-30 19:46 UTC] pajoye@php.net
This patch http://pastie.org/1127049 fixes this issue (along other).
 [2010-08-30 19:48 UTC] pajoye@php.net
The following patch has been added/updated:

Patch Name: lstat-support-1
Revision:   1283190512
URL:        http://bugs.php.net/patch-display.php?bug=51766&patch=lstat-support-1&revision=1283190512
 [2010-08-31 10:53 UTC] pajoye@php.net
The following patch has been added/updated:

Patch Name: add_lstat_support
Revision:   1283244780
URL:        http://bugs.php.net/patch-display.php?bug=51766&patch=add_lstat_support&revision=1283244780
 [2010-09-01 12:12 UTC] pajoye@php.net
-Status: Assigned +Status: Closed
 [2010-09-01 12:12 UTC] pajoye@php.net
Patch applied to PHP_5_3 and trunk, fixing is_link and SPL's related methods.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 12:03:33 2021 UTC