From:             
Operating system: Windows 7 SP1
PHP version:      5.3.10
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:Windows symlink resolution differs between mkdir and 
file_put_contents

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61002&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61002&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61002&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61002&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61002&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61002&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61002&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61002&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61002&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61002&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61002&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61002&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61002&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61002&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61002&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61002&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61002&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61002&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61002&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61002&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61002&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61002&r=mysqlcfg

Reply via email to