ID: 28775 Updated by: [EMAIL PROTECTED] Reported By: aldo at pepperstream dot nl -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: SuSe PHP Version: 4.3.6 New Comment:
That's not a require_once problem. You are confused about what the current working directory is as your script is executing. All includes are relative to the top script, so even if you include module/module.php and in the include inc/lib.php this will be top/inc/lib.php and not top/module/inc.php. This is so you can move things around and have it work the same no matter where you put things. As long as you keep this in mind and always include relative to the top, everything should work a lot better for you. ;) Previous Comments: ------------------------------------------------------------------------ [2004-06-22 17:09:03] jochem at pepperstream dot nl I updated the script at http://vorm.net/bug28775.tar.gz to use require_once() instead of include(). Problem is the same, and behaviour of include() and require_once() is (and should, according to the manual) be the same in this respect. So I think the quoted part of the manual still applies. So perhaps this behaviour is by design (and not a bug), BUT it is problematic in large projects. It should in my opinion actually behave as C does in this respect, which means the example code should display 'Hello World' instead of 'function not defined'. I would appreciate if others would look at this and test if it is actual a bug and/or behaviour that can be changed. ------------------------------------------------------------------------ [2004-06-22 15:51:48] aldo at pepperstream dot nl Then the script I put there is wrong. I will upload a new one shortly. It should have set include_once and not include. I will add a new reply with a new script that should simulate the bug. My applogies for the mistake. ------------------------------------------------------------------------ [2004-06-18 19:04:58] imprestavel at gameguru dot com dot br At the url you just said, you gave an example using include, and not include_once/require_once. I suspect that you have the wrong idea of how include works. http://www.php.net/include/ Second paragraph: "Files for including are first looked in include_path relative to the current working directory and then in include_path relative to the directory of current script. E.g. if your include_path is ., current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/ and then in /www/include/." ------------------------------------------------------------------------ [2004-06-16 09:12:30] aldo at pepperstream dot nl Of course. You can find a script that triggers this possible bug at: http://www.vorm.net/bug28775.tar.gz ------------------------------------------------------------------------ [2004-06-14 19:46:57] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. Please provide a complete PHP script needed to reproduce the problem. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/28775 -- Edit this bug report at http://bugs.php.net/?id=28775&edit=1