|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2013-09-18 12:51 UTC] giunta dot gaetano at gmail dot com
 Description:
------------
is_link seems to return false for junction points which show up as <JUNCTION> when using the DIR command.
It seems to work for junctions which show up as <SYMLINKD> when using the DIR command.
tested on php 5.3.27 and 5.4.14 (32 bit of course)
Test script:
---------------
<?php
$paths = array(
  "linksource",
  "linktarget",
  "linktarget2"
);
foreach ( $paths as $path )
{
  echo "----\n $path\n";
  var_dump( is_link( $path ) );
  var_dump( is_dir( $path ) );
  var_dump( array_diff( stat($path), lstat($path) ) );
}
Expected result:
----------------
results of DIR command:
07/09/2013  15:59    <DIR>          linksource
07/09/2013  19:11    <JUNCTION>     linktarget [D:\htdocs\linksource]
18/09/2013  14:30    <SYMLINKD>     linktarget2 [linksource]
Actual result:
--------------
D:\htdocs>php linktest.php
----
 linksource
bool(false)
bool(true)
array(0) {
}
----
 linktarget
bool(false)
bool(true)
array(8) {
  [2]=>
  int(16895)
  [8]=>
  int(1378562389)
  [9]=>
  int(1378562389)
  [10]=>
  int(1378562389)
  ["mode"]=>
  int(16895)
  ["atime"]=>
  int(1378562389)
  ["mtime"]=>
  int(1378562389)
  ["ctime"]=>
  int(1378562389)
}
----
 linktarget2
bool(true)
bool(true)
array(8) {
  [2]=>
  int(16895)
  [8]=>
  int(1378562389)
  [9]=>
  int(1378562389)
  [10]=>
  int(1378562389)
  ["mode"]=>
  int(16895)
  ["atime"]=>
  int(1378562389)
  ["mtime"]=>
  int(1378562389)
  ["ctime"]=>
  int(1378562389)
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 11:00:01 2025 UTC | 
<?php $link = symlink('a', 'b'); is_link($link);// Return FALSE ?> PHP can not detect symlinks that it creates.