php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53642 CLI include_path bug
Submitted: 2011-01-03 17:00 UTC Modified: 2012-05-24 23:49 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: php at kingsquare dot nl Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 5.3.4 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at kingsquare dot nl
New email:
PHP Version: OS:

 

 [2011-01-03 17:00 UTC] php at kingsquare dot nl
Description:
------------
On Windows 7, 'include' fails to load files from some folders in the include_path, 
when the 'include_path' is configured like.

include_path = ".;C:\xampp\php\PEAR\;C:\myApp\"

It seems that, when starting the include path with '.;', everything after the 
second folder (e.g. C:\myApp\ and further ) is ignored by the include-command.

When '.;' is removed from the include_path, everything works as expected.

This behaviour only appears when using PHP as CLI.

Test script:
---------------
<?php

//make sure C:\myApp\MyClass.php does exists!

set_include_path('.;C:\xampp\php\PEAR\;C:\myApp\');
include 'MyClass.php';
$obj = new MyClass();
print_r($obj);

Expected result:
----------------
Some info about the $obj-object

Actual result:
--------------
PHP Fatal error:  Class 'MyClass' not found in <testscript.php>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-07 11:40 UTC] cornernote at gmail dot com
From CLI on Windows 7, when I call include() on a file that is in my 
include_path there are some very strange results.

Basically the outcome is that the file is NOT included, and a new file gets 
created at the same level as the original script.

I have tried to replicate on BSD, CentOS, Debian, Ubuntu, WinXP.  All of these 
work perfectly with no bug.


# php --version
PHP 5.3.1 (cli) (built: Nov 20 2009 17:26:32)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies


# echo "<?php set_include_path('.'.PATH_SEPARATOR.'./folder'); 
include('file.php'); ?>" > bug.php
# dir
---[ output begin ]---
07/03/2011  08:55 PM    <DIR>          .
07/03/2011  08:55 PM    <DIR>          ..
07/03/2011  08:53 PM                83 bug.php
               1 File(s)             83 bytes
               2 Dir(s)
---[ output end ]---


# php bug.php
---[ output begin ]---
Warning: include(file.php): failed to open stream: No such file or directory in 
C:\xampp\htdocs\test\cli_bug\bug.php on line 1
Warning: include(): Failed opening 'file.php' for inclusion 
(include_path='.;./folder') in C:\xampp\htdocs\test\cli_bug\bug.php on line 1
---[ output end ]---


# mkdir folder
# echo "INCLUDED FILE" > folder/file.php
# php bug.php
---[ output begin ]---
---[ output end ]---


# dir
---[ output begin ]---
07/03/2011  08:54 PM    <DIR>          .
07/03/2011  08:54 PM    <DIR>          ..
07/03/2011  08:53 PM                83 bug.php
07/03/2011  08:54 PM                 0 file.php
07/03/2011  08:54 PM    <DIR>          folder
               2 File(s)             83 bytes
               3 Dir(s)  612,782,497,792 bytes free
---[ output end ]---
 [2012-05-24 23:49 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-05-24 23:49 UTC] felipe@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

It makes no sense, still you reproducing it in newer version?
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 16 16:05:46 2022 UTC