note 98033 rejected from ini.core by danbrown

From: Date: Fri, 21 May 2010 15:51:37 +0000
Subject: note 98033 rejected from ini.core by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169502@lists.php.net to get a copy of this message
Note Submitter: Phil Perry ---- Has the behavior of include/require WRT "." in "include_path" changed in a recent PHP version? Scenario: /home/XXXXX/catalog/index.php requires 'includes/application_top.php'. found OK /home/XXXXX/catalog/includes/application_top.php includes 'includes/languages/english.php' (for example). /home/XXXXX/catalog/includes/languages/english.php exists. This used to work fine, but lately lots of users of certain products get "not found" errors. They are using the default "include_path" which includes ".". I haven't been able to prove it, but it looks like in older PHPs, "." is the directory of the OUTERMOST includer (/catalog/), while in newer PHPs, it is the directory of the INNERMOST includer (/catalog/includes/). I suspect that this is resulting in PHP looking for /home/XXXXX/catalog/includes/includes/languages/english.php, and not finding it. Unfortunately, the error message doesn't give the resulting full path, so I can't confirm it. One could add /home/XXXXX/catalog/ to the include_path, but in this particular case, there is a problem: some scripts are running in /catalog/admin/, so they will pick up the wrong (/catalog/) application_top.php file (/home/XXXXX/catalog/includes/application_top.php, rather than /home/XXXXX/catalog/admin/includes/application_top.php), using this "fix". Any suggestions? Is the only other way out to rewrite all the requires and includes with absolute (full) paths?

« previous php.notes (#169502) next »