From:             geoffwa at cs dot rmit dot edu dot au
Operating system: Solaris 10
PHP version:      5.2.3
PHP Bug Type:     Streams related
Bug description:  Can't open files with leading relative path of '..' and '..' 
is not readable

Description:
------------
(possibly related to bug #39953 or bug #39351)

If a relative path to a file has '..' as a leading path component,
and the directory referred to by '..' is not readable by the user,
then opening a file using the relative path fails.

Using an absolute path or a path with a non-'..' leading component
opens said file just fine.



Reproduce code:
---------------
See http://goanna.cs.rmit.edu.au/~geoffwa/relative_path_bug.php
for a large test script.

Expected result:
----------------
(Using PHP 5.1.4)
Current working directory is: /home/g/geoffwa/test
Opened /home/g/geoffwa/test/a/b/file
Opened ./a/b/file from ./a using ./b/file
Opened ./a/b/file from ./a using ./b/c/../file
Opened ./a/b/file from ./a/b/c using ../file
Opened ../file from ./a/b/c using ./../file
Opened ./a/b/file from ./a/b using ./file
Opened ./a/file from ./a/b using ./c/../../file
Opened ./a/b/c/file from ./a/b/c using ../c/file


Actual result:
--------------
(Using PHP 5.2.3 + suhosin patch)
Opened /home/g/geoffwa/test/a/b/file
Opened ./a/b/file from ./a using ./b/file
Opened ./a/b/file from ./a using ./b/c/../file
Failed to open ./a/b/file from ./a/b/c using ../file
Failed to open ./a/b/file from ./a/b/c using ./../file
Opened ./a/b/file from ./a/b using ./file
Opened ./a/file from ./a/b using ./c/../../file
Failed to open ./a/b/c/file from ./a/b/c using ../c/file


-- 
Edit bug report at http://bugs.php.net/?id=41899&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41899&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41899&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41899&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41899&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41899&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41899&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41899&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41899&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41899&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41899&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41899&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41899&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41899&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41899&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41899&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41899&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41899&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41899&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41899&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41899&r=mysqlcfg

Reply via email to