Bug #31061
defective and maybe obsolete is_link() mirror function
Status: | Resolved | Start date: | 2011-10-18 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Bastian Waidelich | % Done: | 100% |
|
Category: | Utility | |||
Target version: | TYPO3 Flow Base Distribution - 1.0.0 | |||
PHP Version: | Complexity: | |||
Has patch: | Affected Flow version: |
Description
in \TYPO3\FLOW3\Utility\Files the function is_link is defective. The function returns
return $normalizedPathAndFilename !== $normalizedTargetPathAndFilename
in my concrete case the both variables had the values
c:/users/afoeder/phpstormprojects/[...]/flow3/data/temporary/development/cache/data/flow3_monitor/ c:/users/afoeder/phpstormprojects/[...]/flow3/data/temporary/development/cache/data/flow3_monitor
(note the trailing slash at the first one, $normalizedPathAndFilename). This leads to an incorrect function result and therefore ::emptyDirectoryRecursively
does not work because it's relying on that function.
Anyhow, this function is a wrapper because of a bug; see the annotation If http://bugs.php.net/bug.php?id=51766 gets fixed we can drop this.
This seems fixed, hence the function could be removed and usages can be renamed to the native is_link() function.
Associated revisions
[BUGFIX] make is_link() work around work for paths with trailing slash
On Windows \TYPO3\FLOW3\Utility\Files::is_link() compares the
given path with the resolved absolute path due to a bug in the
native is_link() implementation.
This fails if the given path ends on a slash because that is
stripped of by PHPs realpath() function.
This change strips of any trailing slash before comparing the
paths.
Change-Id: I94c53b5fe8dda82c05690cf02286091672d0650e
Resolves: #31061
History
#1 Updated by Robert Lemke almost 4 years ago
- Target version changed from 1.0.0 to 1230
#2 Updated by Karsten Dambekalns almost 4 years ago
- Status changed from New to Needs Feedback
Bastian, can you confirm this?
#3 Updated by Bastian Waidelich almost 4 years ago
- Assigned To set to Bastian Waidelich
Unfortunately on PHP 5.3.5 (on Windows 7 @ 64bit) neither is_link() nor SplFileInfo::isLink() work correctly..
Steps to reproduce:
- Create a file "test.php":
1$linkPathAndFilename = __DIR__ . DIRECTORY_SEPARATOR . 'link.php'; 2symlink(__FILE__, $linkPathAndFilename); 3 4var_dump(is_link($linkPathAndFilename)); 5 6$fileInfo = new SplFileInfo($linkPathAndFilename); 7var_dump($fileInfo->isLink());
Expected: bool(true) bool(true)
Actual: bool(false) bool(false)
I'll take care of stripping the trailing slash though in \TYPO3\FLOW3\Utility\Files::is_link()
#4 Updated by Bastian Waidelich almost 4 years ago
Bastian Waidelich wrote:
Unfortunately on PHP 5.3.5 (on Windows 7 @ 64bit) neither is_link() nor SplFileInfo::isLink() work correctly..
BTW: In trunk this might be fixed (I'll check this), but updating the required PHP version one day before launch would be ..well.. crazy ;)
#5 Updated by Mr. Hudson almost 4 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 of change I94c53b5fe8dda82c05690cf02286091672d0650e has been pushed to the review server.
It is available at http://review.typo3.org/5969
#6 Updated by Bastian Waidelich almost 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b306b18ac9efcba83ae9525bf470cc020d6d4b34.
#7 Updated by Karsten Dambekalns almost 4 years ago
- Target version changed from 1230 to 1.0.0