|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-13 20:26 UTC] mattficken@php.net
[2013-06-20 12:03 UTC] ab@php.net
-Status: Open
+Status: No Feedback
[2013-06-20 12:03 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 20:00:02 2025 UTC |
Description: ------------ d:/link/ is a windows symlink to d:/a/b/c mkdir('d:/link/../new') creates link in d:/ - that OK. file_put_contents('d:/link/../new', 'OK'); tries to create file in d:/a/b (because d:/link/ resolved to d:/a/b/c, and d:/a/b/c/../new now points to d:/a/b/new). This difference between mkdir and file_put_contents was not expected. Test script: --------------- <?php $dirname = 'd:/link/../new'; $realDirname = 'd:/new'; echo "Is Dir exists? ", is_dir($realDirname) ? 'Yes' : 'No', PHP_EOL, 'Create Dir', PHP_EOL; mkdir($dirname); echo "Is Dir exists NOW? ", is_dir($realDirname) ? 'Yes' : 'No', PHP_EOL; file_put_contents("$dirname/file", 'OK'); echo 'OK'; Expected result: ---------------- Is Dir exists? No Create Dir Is Dir exists NOW? Yes OK Actual result: -------------- Is Dir exists? No Create Dir Is Dir exists NOW? Yes <br /> <b>Warning</b>: file_put_contents(d:/link/../new/file) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>D:\test.php</b> on line <b>10</b><br /> OK