Bug #8432

Fix Symlink support for Windows OS

Added by Bastian Waidelich about 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-06-22
Priority:Must have Due date:
Assigned To:Bastian Waidelich % Done:

100%

Category:Resource
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 11
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

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)..


Related issues

related to TYPO3.Flow - Task #8056: Remove configuration option for mirrorMode Closed

Associated revisions

Revision 56b6ac99
Added by Bastian Waidelich about 5 years ago

[+BUGFIX] FLOW3: Added helper function \F3\FLOW3\Utility\Files::is_link() that works on Windows too. This resolves #8432.

History

#1 Updated by Karsten Dambekalns about 5 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Karsten Dambekalns

From the PHP manual about readlink():
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.

Given that what we see is a bug in PHP...
http://bugs.php.net/bug.php?id=52175
http://bugs.php.net/bug.php?id=51766
wait until they fix it?

#2 Updated by Bastian Waidelich about 5 years ago

  • Status changed from Needs Feedback to Accepted
  • Assigned To 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.

#3 Updated by Bastian Waidelich about 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r4862.

#4 Updated by Karsten Dambekalns about 5 years ago

  • Target version set to 1.0 alpha 11

Also available in: Atom PDF