#28775 [Com]: Require_once fails on diff. files in different dirs with same name & path
ID: 28775
Comment by: imprestavel at gameguru dot com dot br
Reported By: aldo at pepperstream dot nl
Status: Open
Bug Type: Scripting Engine problem
Operating System: SuSe
PHP Version: 4.3.6
New Comment:
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/."
Previous Comments:
------------------------------------------------------------------------
[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] iliaa@php.net
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.
------------------------------------------------------------------------
[2004-06-14 17:18:08] aldo at pepperstream dot nl
Description:
------------
I hope this bug has not already been reported but I have the following
directory structure:
root
\_ src
|_ plugins
\_ [nameplugin]
\_ src
(so a src directory in both root and in a plugin two directories
further up)
In a file in the root I refer to:
require_once('src/library.php');
and I do the same in the root/plugins/[nameplugin] directory:
require_once('src/library.php');
Now the second library.php refuses to be included. It referes to two
different files, but the include looks similar due to the relative
path's being used.
When I renamed the second library.php to library2.php a test all my
functions and also some test code started working.
Reproduce code:
---------------
root/index.php
require_once('src/library.php');
root/plugins/[nameplugin]/[nameplugin].php
require_once('src/library.php');
Expected result:
----------------
I expected both library.php's who exist on different path's to work and
not just the one to be included, as both files are actually different,
only their names and the relative path to differ.
Actual result:
--------------
second library.php was not included.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28775&edit=1
Thread (8 messages)