Bug #14638 Updated: Allow include() & friends to use relative paths better

From: Date: Fri, 21 Dec 2001 12:50:02 +0000
Subject: Bug #14638 Updated: Allow include() & friends to use relative paths better
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-74685@lists.php.net to get a copy of this message
ID: 14638 Updated by: mfischer Reported By: jukkaho@mail.student.oulu.fi Old Status: Open Status: Closed Bug Type: Feature/Change Request Operating System: All PHP Version: 4.1.0 New Comment: If you have '.' in your include_path your examples work as expected. Previous Comments: ------------------------------------------------------------------------ [2001-12-21 07:32:04] jukkaho@mail.student.oulu.fi Currently all include()-type functions with relative include paths are relative to file, which is server by webserver ($SCRIPT_NAME). It would make life a lot easier if include() could be enchanced to accept optional flag parameter (or perhaps it would be better to create new function names to avoid magic-flag -pollution). And if it's set, include would be done relative to including file (instead of $SCRIPT_NAME). For example with this ability, following code should work as expected: index.php (also $SCRIPT_NAME): <?php include("include/second.php"); ?> include/second.php: <?php include("third.php",1); ?> include/third.php: <?php echo "Ok."; ?> This allows much easier code portability where directory trees are different (difficult to play with $DOCUMENT_ROOT). ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14638&edit=1

« previous php.dev (#74685) next »