Fix Symlink support for Windows OS
With version 5.3 PHP supports symlinks on Windows >= Vista.
symlink($target, $link) works indeed on my Windows 7 machine. But is_link($link) returns FALSE.
That's why the unit test
F3\FLOW3\Resource\Publishing\FileSystemPublishingTargetTest::mirrorFileSymLinksTheGivenFileIfTheSettingSaysSo()fails on Windows.
A solution might be to use readlink() instead of is_link() as readlink() returns the same for $target and $link (the path to the target)..
Updated by Karsten Dambekalns over 11 years ago
- Status changed from New to Needs Feedback
- Assignee set to Karsten Dambekalns
From the PHP manual about
This will trigger a warning and return false if you pass it a non-symlink.
This is something we don't want, no warnings please. So we'd have to check for the OS as well.
Updated by Bastian Waidelich over 11 years ago
- Status changed from Needs Feedback to Accepted
- Assignee changed from Karsten Dambekalns to Bastian Waidelich
After a short chat with Karsten, we found out:
readlink() does not trigger a warning on Windows as long as you pass it a path to an existing file/folder or symlink.
Because the symlink integration is implemented very deep in the Windows filesystem, I doubt that PHP will be able to fix this issue soon. So we decided to add a new utility helper function F3\FLOW3\Utility\Files::is_link() that uses the readlink() workaround on Windows.