php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51569 Documentation of include missing fallback to calling script's cwd
Submitted: 2010-04-16 14:00 UTC Modified: 2010-09-15 08:59 UTC
From: privat at ni-po dot com Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: privat at ni-po dot com
New email:
PHP Version: OS:

 

 [2010-04-16 14:00 UTC] privat at ni-po dot com
Description:
------------
The documentation of include (http://php.net/manual/en/function.include.php) is missing an important fact:

If PHP cannot identify the filename as a stream wrapper, a relative or absolute path and cannot find filename in one of the include paths, it will fall back to the calling script's current working directory. See http://svn.php.net/viewvc/php/php-src/trunk/main/fopen_wrappers.c?view=markup on lines 602 - 638.

I spent some nice hours to find that out, I think it really should be a documented feature.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-22 19:43 UTC] privat at ni-po dot com
-PHP Version: 5.3.2 +PHP Version: Irrelevant
 [2010-05-22 19:43 UTC] privat at ni-po dot com
Updated bug type and php version
 [2010-05-22 19:44 UTC] privat at ni-po dot com
-Type: Bug +Type: Documentation Problem
 [2010-05-22 19:44 UTC] privat at ni-po dot com
Now *really* updated it...
 [2010-09-15 02:15 UTC] mail_ben_schmidt at yahoo dot com dot au
Just to clarify, we're saying here that when you do

include($relative_path)

PHP falls back to trying the equivalent of

include(dirname(__FILE__).DIRECTORY_SEPARATOR.$relative_path)

aren't we?

I.e. it checks relative to the location of the current script, not relative to the current working directory (that behaviour is already documented, though perhaps not well).
 [2010-09-15 03:30 UTC] mail_ben_schmidt at yahoo dot com dot au
This appears to be a regression from bug #41460 where the documentation included this fact and was clarified to ensure the behaviour was properly described.

See also bug #52845 for another documentation deficiency related to include and include_path, and bug #52847 for what I think is a documentation problem, but may be a behaviour problem.
 [2010-09-15 08:43 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2010-09-15 08:58 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=303380
Log: Fix doc bug #51569 (Documentation of include missing fallback to calling
script's cwd) by adding clarifying note about the final fallback when including
a file.
 [2010-09-15 08:59 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2010-09-15 08:59 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 02:01:33 2024 UTC