ID: 39542 User updated by: snowy at corporatezoo dot com Reported By: snowy at corporatezoo dot com Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 5.2.0 New Comment:
oh so maybe the search order is different between require and require_once? hmmm makes senses since it looks like a namespace caching issue. Previous Comments: ------------------------------------------------------------------------ [2007-02-02 22:02:34] jsnell at e-normous dot com Test case: Create a file called test.php with the following: <?php set_include_path(dirname(__FILE__).'/lib/'); echo(get_include_path()."\n"); require_once('test.php'); ?> and create a subdirectory called lib, containing a file called test.php with the following contents: Included Test from lib/ Results with php 4 (PHP 4.4.4 (cli) (built: Nov 1 2006 18:10:56) -- osx 10.4.x: /Users/jsnell/delete/php5/testcase/lib/ Included Test from lib/ Results with PHP 5.1.4 (PHP 5.1.4 (cli) (built: Jan 25 2007 11:50:25) ): php5 test.php /Users/jsnell/delete/php5/testcase/lib/ Included Test from lib/ Results with PHP CVS (anon checked out on February 2nd): ../sapi/cli/php test.php /Users/jsnell/delete/php5/testcase/ -- I believe the original submission is wrong, by changing require_once() to require(), the file from lib/ is being loaded. ------------------------------------------------------------------------ [2007-02-02 16:48:00] jsnell at e-normous dot com Also seeing this in: PHP 5.2.0-8 (cli) (built: Dec 17 2006 20:03:51) using Linux relay 2.4.29 #2 SMP Sat Mar 12 13:17:01 CST 2005 i686 GNU/Linux ------------------------------------------------------------------------ [2006-11-28 22:45:47] snowy at corporatezoo dot com Hi any update on this? btw, in case it was confusing, that wasn't a "fix" I posted, it is merely a way to circumvent the behaviour. Obviously this "fix" would require the renaming of all php class files in old code, which is an extreme pain, but it would be ok, if I could just confirm what the new "behaviour" of includes is meant to be. If there is not supposed to be a change in the behaviour of includes/requires, then this is probably a bug ------------------------------------------------------------------------ [2006-11-17 23:45:30] snowy at corporatezoo dot com Oh btw (in case it wasn't obvious), the "remedy" is 1) rename the class file to "fooIndex.php" 2) rename the class to fooIndex 3) in index.php, $index = new fooIndex(); so the issue is when the script "driver" file (ie, the one in docroot) is named the same as the class file (in the class path) even when the 2 files are of different case (index.php vs Index.php). ------------------------------------------------------------------------ [2006-11-17 23:39:53] snowy at corporatezoo dot com actually I am using full paths, I'm doing a: define('SITEROOT_DIR','/web/myproject'); define('FRAMEWORK_DIR','/web/framework'); define('SITECLASS_DIR',SITEROOT_DIR.'/_application'); set_include_path(SITECLASS_DIR.';'.FRAMEWORK_DIR.';'.get_include_path()); and /web/myproject/docroot is the docroot (I've always been using this kind of naming with "/" for windows since 4.0.x in case I need compat) It's almost as if it found index.php in the current namespace, and decides it doesn't need to go to include_path to look for one? just guessing... ------------------------------------------------------------------------ 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/39542 -- Edit this bug report at http://bugs.php.net/?id=39542&edit=1