php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27146 include inconsistency of identical scripts
Submitted: 2004-02-04 11:19 UTC Modified: 2004-02-05 07:19 UTC
From: omich at artofaktur dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.4 OS: DebianLinux www 2.4.23-1-686-smp
Private report: No CVE-ID: None
 [2004-02-04 11:19 UTC] omich at artofaktur dot de
Description:
------------
A script 'A', which 'include's a php script file 'X' 
from a subfolder of the php.ini-include path, does work 
fine, but the exact same copy of the script of 'A' (call 
it 'B') in a different folder does not include the file 
'X' at all.
Example here: www.dannemann.com/info.php shows the 
environment. The script 'A' is
www.dannemann.com/de/kompetenz/lexikon/search.php
the script 'B' is
www.dannemann.com/at/kompetenz/lexikon/search.php
Both load file 'X' which is located in 
www.dannemann.com/global/dict.php 
from the global folder, but only in 'de' the include 
works, not in 'at'.

In the given code I have replaced the flawed include 
command with a hack:
eval (substr (implode ('', file ($DOCUMENT_ROOT.'/
global/dict.php')), 2, -2));
and this works!

We use output buffering before this code and fetched the 
output and transparent php sessions without cookies (see 
phpinfo-output). Although we use APC-Cache we disabled 
it for testing - to no avail even without APC the 
include fails...

Thank you for your patience...

Reproduce code:
---------------
// this is the calling code
...
// dict-lookup
$hits_per_page = 10;
include ('gobal/dict.php');
$arr = split ($dictsep, $search);
foreach ($arr as $token) {
...

Expected result:
----------------
dict.php cotains two arrays of key-value pairs and looks 
like this:
<?
$dictsep = "[ \t\n\r<>,.:\(\)]";
$dict = array (
"ich",
"du",
"er",
"sie",
...
?>
These variables should be visible to the calling script, 
which is for 'at' not the case.

Actual result:
--------------
The two 'imported' variables $dictsep and $dict are not 
even set (isset on both resulted in false) for 'at'.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-04 13:29 UTC] sniper@php.net
Fix your include_path.

 [2004-02-04 14:02 UTC] omich at artofaktur dot de
The include path is correct, otherwise (as state) none 
of the two script would run.
 [2004-02-04 19:16 UTC] sniper@php.net
Put "error_reporting(E_ALL);" as first line on all files related. And also "var_dump(ini_get('include_path'));".
You propably have some .htaccess files or vhost setting the include path to something else..

 [2004-02-05 04:47 UTC] omich at artofaktur dot de
error_reporting (E_ALL) showed no errors.
var_dump(ini_get('include_path'))
shows the expected result
string(18) "/var/www/dannemann"
but it does not work!
 [2004-02-05 06:48 UTC] sniper@php.net
What exactly is the directory structure?!
You're obviously doing something wrong, there is no bugs in this stuff, otherwise we'd have hundreds of reports about this..

 [2004-02-05 07:19 UTC] omich at artofaktur dot de
You are right and I found the bug, sorry for the 
interruption, it was a typo:

include ('gobal/dict.php');

the folder is called global - with l in it

Sorry for any interruption, what a pity! Any chance to 
remove all reports and any trails... :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 05:00:03 2025 UTC