From:             
Operating system: WinXP maybe others
PHP version:      5.3.3
Package:          *Directory/Filesystem functions
Bug Type:         Bug
Bug description:include/require problems with ../

Description:
------------
So here is the layout of my files:



B.php

page/1.php

page/A.php

page/mod/2.php



1 and 2 are pages that are used independently.

A and B are included files with classes and functions.

1 includes A which includes B

2 includes A which includes B



This affects the include,include_once,require and require_once functions.

Found this in the 5.2.3 so I upgraded to 5.3.3 and it's still there.

I have WinXP Pro SP3 and use Apache 2.2.4

---

I have come up with a workaround for my site, which is to remove B from A
and include B in 1 and 2 and all the other filers in the page/mod/
directory, but that is just a pain when it shouldn't work like this!
Right?



Expected result:
----------------
Well I expected both 1 and 2 to work.

I should not have to take in to account where the file that includes my
file lies, so 1 and 2 should get the same results.



Actual result:
--------------
The 1,A,B combo works fine.



But the 2,A,B does not. (The B file not found!)



And the thing that goes wrong is when A is to include B with ../B.php it
ignores the ../ and just looks in the current directory of A.

After some more testing I found that 1 including 2 including A would result
in the same error with the file not being found because it searches in the
wrong directory.

So this is similar to the PHP4 error of included files searching from their
parents directory instead of their own when trying to further include
files, but this only happens when an ../ is involved.



If I put ../../B.php in A then it works in 2, but then 1 tries to go back
one directory to much, which it should because that's what's written.

Also /B.php or ./B.php seem to work for 2, but messes things up for 1.

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

Reply via email to