Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Filesystem] fix readlink() for Windows#40866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Filesystem] fix readlink() for Windows#40866
Uh oh!
There was an error while loading.Please reload this page.
Conversation
98bd15f to2ca8c35Comparea1812 commentedApr 20, 2021
I'm not sure if skipping a test is a good idea, but the green bars clearly improve my mood :) |
nicolas-grekas commentedApr 21, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
:D |
a1812 commentedApr 21, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
<?php// check behavior functions realpath, readlink, and component Symfony Filesystem for windowsrequire_once__DIR__ .'/../vendor/autoload.php';useSymfony\Component\Filesystem\Filesystem;$dir =__DIR__ .DIRECTORY_SEPARATOR .'dir';mkdir($dir);$file =$dir .DIRECTORY_SEPARATOR .'file';$link1 =$dir .DIRECTORY_SEPARATOR .'link1';$link2 =$dir .DIRECTORY_SEPARATOR .'link2';touch($file);symlink($file,$link1);symlink($link1,$link2);$fs =newFilesystem();echo'PHP:' .PHP_VERSION .PHP_EOL;echo'realpath:' .realpath($link2) .PHP_EOL;echo'readlink:' .readlink($link2) .PHP_EOL;echo'$fs->readlink($link2, true):' .$fs->readlink($link2,true) .PHP_EOL;echo'$fs->readlink($link2):' .$fs->readlink($link2) .PHP_EOL;unlink($file);unlink($link1);unlink($link2);rmdir($dir); b - before patch, a - after patch
###conclusion:
What to do with PHP 7.3.* ? Correct me, maybe I am confusing or missing something. |
a1812 commentedApr 22, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
how check setPROJECT_DIR=C:\symfonysetPHPUNIT=%PROJECT_DIR%/phpunit^ --colors=never^ --bootstrap%PROJECT_DIR%/vendor\autoload.php^ --configuration%PROJECT_DIR%/phpunit.xml.dist%PROJECT_DIR%/src/Symfony/Component/FilesystemFOR%%VIN ( 7.1.3, 7.1.33, 7.2.15, 7.2.34, 7.3.0, 7.3.15, 7.3.27, 7.3.28, 7.4.0, 7.4.9, 7.4.10, 7.4.15, 7.4.16, 7.4.18, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.5, 8.0.6)DO ( c:\php\%%V\php%PHPUNIT%@if errorlevel1 (exit /b )) |
51a0b9c to76358d0Comparea1812 commentedApr 23, 2021
Hi@nicolas-grekas, please check my code. |
a1812 commentedApr 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
imho need to edit the description, the current one is misleading
https://symfony.com/doc/4.4/components/filesystem.html#readlink |
76358d0 tobd5861fComparea1812 commentedApr 27, 2021
Bug report for PHP7.3.27https://bugs.php.net/bug.php?id=80993 |
a1812 commentedApr 27, 2021
Answer from php.net I think we did everything we could (fixed for 8.0 and >=7.4.10) for behavior our component |
bd5861f tof1b95d3Compare
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(what a mess :) )
nicolas-grekas commentedMay 26, 2021
Thank you@a1812. |
This PR was merged into the 4.4 branch.Discussion----------fix readlink descriptionremove description readlink() for Windows misleadingseesymfony/symfony#40866Commits-------a2dd7ee fix readlink description
How to reproduce
Windows 10.0.19042.928, PHP 8.0.3, PHPUnit 9.5.4
run as Administrator
C:\php\php.exe ./phpunit --bootstrap ./vendor/autoload.php --configuration ./phpunit.xml.dist ./src/Symfony/Component/Filesystem/Tests
There were 2 failures:
Failed asserting that 'C:\Users\albat\AppData\Local\Temp\1618836823.005.2057903605\directory\dir' is false.
D:\Z__PHP_PROJECT\symfony\src\Symfony\Component\Filesystem\Tests\FilesystemTest.php:379
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'C:\Users\albat\AppData\Local\Temp\1618836823.1681.131301953\dir\link'
+'C:\Users\albat\AppData\Local\Temp\1618836823.1681.131301953\file'