php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29698 include suite does not traverse include_path subdirectories
Submitted: 2004-08-16 08:33 UTC Modified: 2005-03-15 01:00 UTC
Votes:11
Avg. Score:4.3 ± 1.3
Reproduced:6 of 6 (100.0%)
Same Version:2 (33.3%)
Same OS:4 (66.7%)
From: mills at sinetechnologies dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.1 OS: Win XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-08-16 08:33 UTC] mills at sinetechnologies dot com
Description:
------------
This is new for PHP5. PHP4 works as expected. 

Using require_once as the test, and having a properly set up include path, require_once does not travel farther down the include_path to locate files to include. 

Same behavior in cgi and module implementations. 

For example, take the following include path: 
include_path = ".;C:\Program Files\Apache Group\Apache\php\include"

In the include directory is another directory called 'phrame'

The phrame directory contains files and folders. The file 'include.php' contains other include calls such as include( 'util/Object.php'); (the location of which is "C:\Program Files\Apache Group\Apache\php\include\phrame\util\Object.php") This should use . and then find the util/Object.php. It does in PHP4, but not in PHP5. 

It looks like the parser is only going one directory deep when searching for files, and not allowing recursive calls. For PHP4, it works as expected, and all files are included, but PHP5 only goes one directory deep, and fails for subdirectories. 

This makes implementing projects built with PHP4 and extending them with PHP5 a nightmare for both server administrators and developers.

Directory Structure Summary:  

/include
    /phrame
        include.php
        /util
            /Object.php



Reproduce code:
---------------
//load include page which loads other needed pages
require_once 'phrame/include.php'; 

//directly load a needed page for test purposes. 
require_once 'phrame/util/Object.php';

Expected result:
----------------
//in PHP4
//include loaded and all other pages loaded
require_once 'phrame/include.php';
 
//a direct call to this page gets loaded. 
require_once 'phrame/util/Object.php';

Actual result:
--------------
//in PHP5
//partial works, include.php is included if blank,
//but because of other include calls, the require_once
//causes this page to fail to load.
require_once 'phrame/include.php'; 

//does not work! page fails to load 
require_once 'phrame/util/Object.php';

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-18 12:25 UTC] scooter at butterball dot demon dot co dot uk
Hi,

We have resolved this bug on our Solaris box.

The php.ini file was still the old php4 version, we installed the php5 version of the php.ini file and now recursive includes work fine on the Solaris box.  

They always worked on the Fedora box, but it had the php5 .ini file installed from the start.

Not sure if this is a solution to the apparent bug on Win XP, but it worked for us.

One last point the include_path on the php.ini file was the only element changed from the default, the '.' was changed to './' - this may also be important.

Scooter
 [2004-08-19 04:51 UTC] mills at sinetechnologies dot com
Changing the '.' to './' had no success on the problem. 

Also, I cannot directly call C:\Program Files\Apache Group\Apache\php\include\phrame\util\HashMap.php (it is two directories below the include directory). 

But I can directly call C:\Program Files\Apache Group\Apache\php\include\include.php

Permissions on the files are the same.
 [2005-03-07 20:25 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

And copy the provided php.ini-dist over your php.ini..

 [2005-03-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-06-07 16:17 UTC] cors1604-php451 at yahoo dot com
I tested the new version and I still having the same bug reported.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 12:01:30 2024 UTC