Bug #70139 [Opn->Fbk]: is_link or DirectoryIterator->isLink don't work

From: Date: Tue, 28 Jul 2015 23:39:04 +0000
Subject: Bug #70139 [Opn->Fbk]: is_link or DirectoryIterator->isLink don't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194794@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70139&edit=1

 ID:                 70139
 Updated by:         cmb@php.net
 Reported by:        tomkrawc at gmail dot com
 Summary:            is_link or DirectoryIterator->isLink don't work
-Status:             Open
+Status:             Feedback
 Type:               Bug
-Package:            Win32API related
+Package:            Filesystem function related
 Operating System:   Windows 7 64bit
 PHP Version:        5.5.27
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

See also <http://sscce.org/>.


Previous Comments:
------------------------------------------------------------------------
[2015-07-26 10:12:26] tomkrawc at gmail dot com

Description:
------------
Neighter is_link nor DirectoryIterator->isLink are not distinguish symlinks created with os
command mklink. Os is showing them:

2015-07-26  09:23    <DIR>          .
2015-07-26  09:23    <DIR>          ..
2015-05-23  20:55    <DIR>          _backup
2015-05-23  20:55    <DIR>          _logi
2015-07-26  09:23    <DIR>          fileadmin
2015-07-26  08:39    <SYMLINKD>     typo3 [typo3_src\typo3]
2015-07-26  08:39    <SYMLINKD>     typo3_src [..\typo3_src-6.2.14]
2015-07-26  09:23    <DIR>          typo3conf
2015-07-26  09:23    <DIR>          typo3temp
2015-07-26  09:23    <DIR>          uploads
2015-05-24  10:12             5 199 .htaccess
2015-04-14  20:03               113 index.html
2015-07-26  08:39    <SYMLINK>      index.php [typo3_src\index.php]
2015-05-23  18:40                19 pi.php

My env is Win 7 x64, WAMP (Apache 2.4.9, PHP 5.5.12 Thread Safe).

Test script:
---------------
if ($handle = opendir($dir)) {
	echo "Directory handle: $handle\n";
	echo "Entries:\n";

	while (false !== ($entry = readdir($handle))) {
		
		if (is_link($dir . $entry)) {
			$strTarget = readlink($entry);
			echo '>>LINK<<: ' . $entry . ' => ' . $strTarget .
"\n";
		}
		elseif (is_file($dir . $entry)) {
			echo 'File: ' . $entry . "\n";
		}
		elseif (is_dir($dir . $entry)) {
			echo 'Dir: ' . $entry . "\n";
		}
		else {
			echo "? - $entry\n";
		}
	}
	closedir($handle);
}


Expected result:
----------------
both of those methods should return true

Actual result:
--------------
both of those methods should return false


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70139&edit=1


Thread (6 messages)

« previous php.bugs (#194794) next »