php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53849 Nested includes not resolved
Submitted: 2011-01-26 17:52 UTC Modified: 2011-01-26 18:13 UTC
From: nevermind at phpsimplicity dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.3.5 OS: Windows XP SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nevermind at phpsimplicity dot com
New email:
PHP Version: OS:

 

 [2011-01-26 17:52 UTC] nevermind at phpsimplicity dot com
Description:
------------
I have the following structure:
common/a.php
parent/b.php
parent/child/c.php

Now, in c.php, I included the file b.php from the "parent" folder using relative path. b.php includes a.php from "common" folder using also relative path.

When I call c.php, it fails to include common/a.php within parent/b.php
However, when I call b.php it includes common/a.php with no problem.

And just to be clear, I have code in b.php (the actual one) that I need to keep separate from both a.php and c.php..

I have two physically different servers:
Development:
- Windows XP SP3
- Zend Server Community Edition 5.0.2 (Running PHP 5.3.2)

Production:
- Windows 2000 Small Business Server
- Apache 2.2
- PHP 5.3.5 (As Apache module)

Test script:
---------------
[a.php]
<?php
echo 'I am in!';


[b.php]
<?php
require_once '../common/a.php';


[c.php]
<?php
require_once '../b.php';

Expected result:
----------------
When c.php is executed, the inclusion of common/a.php and the output of:
"I am in!"

Actual result:
--------------
Production Server:
Warning: require_once(../common/a.php): failed to open stream: No such file or directory in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\parent\b.php on line 3 Fatal error: require_once(): Failed opening required '../common/a.php' (include_path='.;C:\php\pear') in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\parent\b.php on line 3 

Development Server:
Warning: require_once(../common/a.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files\Zend\Apache2\htdocs\test\parent\b.php on line 2

Fatal error: require_once() [function.require]: Failed opening required '../common/a.php' (include_path='.;C:\Program Files\Zend\ZendServer\share\ZendFramework\library') in C:\Program Files\Zend\Apache2\htdocs\test\parent\b.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-26 18:13 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-01-26 18:13 UTC] pajoye@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 [2011-01-27 08:41 UTC] nevermind at phpsimplicity dot com
Very well. I though I might report this strange behavior. I was not really asking for help as the work around is very easy which is removing the nesting and include both files explicitly in c.php and remove the include from b.php.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC