|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46801 include() searches wrong directory according to the doc
Submitted: 2008-12-08 19:50 UTC Modified: 2008-12-17 19:08 UTC
From: tomas at matfyz dot cz Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
34 + 47 = ?
Subscribe to this entry?

 [2008-12-08 19:50 UTC] tomas at matfyz dot cz
In the documentation ( is the following statement:

"... E.g. if your include_path is libraries, 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/libraries/  and then in /www/include/. ..."

This is not true. There is either a bug in the documentation or in the PHP. 

Tested on 5.2.0-8+etch11.

Reproduce code:
Please see . The source code is in multiple directories, you can download it from there.

Expected result:
www/include/a.php: fun_a()
www/include/b.php: fun_b()

Actual result:
www/include/a.php: fun_a()
www/b.php: fun_b()

According to the documentation, the file www/include/b.php should be included!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-08 19:56 UTC] tomas at matfyz dot cz
Sorry, the correct link is
 [2008-12-08 19:57 UTC] tomas at matfyz dot cz
I can't help it, the link is being wrapped by this website, you must re-construct it.
 [2008-12-08 20:40 UTC] tomas at matfyz dot cz
Note that I would appreciate the behaviour described in the documentation. It seems more logical and more useful than the current behaviour, because there is a risk that local file will override the internal file in the 'include/' dir! The libraries (in this case the sources under 'include/' dir) are compact sets of sources which include themselves and of course do not take into account the files in the user's dir.
 [2008-12-08 22:27 UTC]
Please try using this CVS snapshot:
For Windows:

 [2008-12-08 23:04 UTC] tomas at matfyz dot cz
I'm sorry, I don't have access to newer version of PHP, I'm not a PHP developer. I can use only what my webhosting provider has, which is only older stable versions.

But if you provide me with FTP access to some of your testing servers, I can test it.
 [2008-12-09 12:53 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #46395
 [2008-12-09 20:51 UTC] tomas at matfyz dot cz
If this bug is a duplicate, I believe it should have been marked as duplicate, not as bogus. The "duplicate" state is there for a reason, isn't it? E.g. for gaining more test cases - when the original bug is fixed, all duplicates could be also tested.

Please understand that I'm not looking into this database every day, so it is very hard to find out whether the bug is already reported. Despite of this fact I believe that still the bug reports from public might be useful for PHP.
 [2008-12-17 12:12 UTC]
There is no 'Duplicate' status. Check your facts before complaining.
 [2008-12-17 19:08 UTC] tomas at matfyz dot cz
There ** IS ** "Duplicate" status. Please check your facts before preaching at somebody.

Do I need to post a screenshot? OK:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 23 10:03:32 2021 UTC