Bug #51763 [Opn]: SplFileInfo::getType()
Edit report at http://bugs.php.net/bug.php?id=51763&edit=1
ID: 51763
Updated by: cataphract@php.net
Reported by: v-sumada at microsoft dot com
Summary: SplFileInfo::getType()
Status: Open
Type: Bug
Package: SPL related
Operating System: All windows OS
PHP Version: 5.3.2
New Comment:
This is unrelated to Spl. is_link/etc. are all also windows symbolic
link agnostic. The problem here is that this information is conveyed in
the stat structure. Strictly speaking, the return of getType is not
completely incorrect -- the file type _S_IFREG and symbolic links are in
fact files or (empty) directories with reparse point data. Maybe the
best thing to do would be to change the stat function returned on
windows so that the file type is replaced with _S_IFLNK when the
directory is a junction/symlink or the file is a symlink.
Previous Comments:
------------------------------------------------------------------------
[2010-05-07 03:36:11] v-sumada at microsoft dot com
Description:
------------
The SplFileInfo::getType() For Symbolic link returns "dir" which in turn
should return "link" .This happens to be in 5.3.2 and occurs on all
windows OS.
It Correctly returns the type of file referenced which is for Dir and
File .
<?php
$symlinkdir = "/path/to/symlink"; //Symbolic link
$syminfo = new SplFileInfo($symlinkdir);
var_dump($syminfo->getType());
?>
Expected result :string(4)"Link"
Actual result : string(3) "dir"
Test script:
---------------
<?php
$symlinkdir = "/path/to/symlink"; //Symbolic link
$syminfo = new SplFileInfo($symlinkdir);
var_dump($syminfo->getType());
?>
Expected result:
----------------
string(4)"Link"
Actual result:
--------------
string(3) "dir"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51763&edit=1
Thread (7 messages)