Edit report at http://bugs.php.net/bug.php?id=52838&edit=1
ID: 52838 Updated by: ahar...@php.net Reported by: winzent at gmail dot com Summary: include/require problems with ../ -Status: Open +Status: Bogus Type: Bug Package: *Directory/Filesystem functions Operating System: WinXP maybe others PHP Version: 5.3.3 Block user comment: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Include paths are relative to the initial working directory -- that's how PHP has always worked. You may wish to investigate the __FILE__ and __DIR__ constants in the manual. Previous Comments: ------------------------------------------------------------------------ [2010-09-14 11:18:25] winzent at gmail dot com 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 this bug report at http://bugs.php.net/bug.php?id=52838&edit=1