Bug #31061

defective and maybe obsolete is_link() mirror function

Added by Adrian Föder over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
Utility
Start date:
2011-10-18
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

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.

#1

Updated by Robert Lemke over 9 years ago

  • Target version changed from 1.0.0 to 1230
#2

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from New to Needs Feedback

Bastian, can you confirm this?

#3

Updated by Bastian Waidelich over 9 years ago

  • Assignee 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":

$linkPathAndFilename = __DIR__ . DIRECTORY_SEPARATOR . 'link.php';
symlink(__FILE__, $linkPathAndFilename);

var_dump(is_link($linkPathAndFilename));

$fileInfo = new SplFileInfo($linkPathAndFilename);
var_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 over 9 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 over 9 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 over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#7

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1230 to 1.0.0

Also available in: Atom PDF