#30881 [Opn]: C++ like include (path/search) in PHP?

From: Date: Fri, 26 Nov 2004 14:23:04 +0000
Subject: #30881 [Opn]: C++ like include (path/search) in PHP?
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969365246@lists.php.net to get a copy of this message
ID: 30881 Updated by: vrana@php.net Reported By: ovdspek at liacs dot nl Status: Open Bug Type: Documentation problem Operating System: Debian Linux Sarge PHP Version: 4.3.9 New Comment: You are right, documentation is not absolutely clear. Documented behavior is valid only if you don't go to upper directory in include. b/2.php: <?php include "c/3.php"; ?> b/c/3.php: b/c/3 php b/2.php works as documented - prints b/c/3 (if c/3.php doesn't exist). I will update the docs. Previous Comments: ------------------------------------------------------------------------ [2004-11-26 11:39:05] ovdspek at liacs dot nl > Current working directory can be something different than directory of a script. I understand, but apparently your implementation doesn't. Why else would "include('../1.php');" fail? ------------------------------------------------------------------------ [2004-11-26 11:29:43] vrana@php.net "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." in include() page. Current working directory can be something different than directory of a script. ------------------------------------------------------------------------ [2004-11-26 11:10:37] ovdspek at liacs dot nl So exactly where is that documented? At http://php.net/include/ I see no exceptions for CLI and at http://php.net/manual/en/features.commandline.php I see no exceptions for include. It does say "It does not change the working directory to that of the script. (-C and --no-chdir switches kept for compatibility)", but that's not relevant, as the include docs say it searches the directory of the current script, not the current working directory. If your implementation relies on the current working directory being the directory of the current script, then your implementation (of this docs/specs) is wrong. ------------------------------------------------------------------------ [2004-11-26 10:53:51] tony2001@php.net >In that case, please update your documentation so it >doesn't say it'll search relative to the directory of >current script. All SAPIs except CLI DO search relative to the directory of current running script. But you're using CLI and this feature is documented too. ------------------------------------------------------------------------ [2004-11-26 10:12:22] ovdspek at liacs dot nl In that case, please update your documentation so it doesn't say it'll search relative to the directory of current script. ------------------------------------------------------------------------ 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/30881 -- Edit this bug report at http://bugs.php.net/?id=30881&edit=1

« previous php.doc (#969365246) next »