Edit report at https://bugs.php.net/bug.php?id=53642&edit=1

 ID:                 53642
 Updated by:         fel...@php.net
 Reported by:        php at kingsquare dot nl
 Summary:            CLI include_path bug
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *Configuration Issues
 Operating System:   Windows 7
 PHP Version:        5.3.4
 Block user comment: N
 Private report:     N

 New Comment:

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?


Previous Comments:
------------------------------------------------------------------------
[2011-03-07 11:40:31] 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 ]---

------------------------------------------------------------------------
[2011-01-03 17:00:46] 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>


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53642&edit=1

Reply via email to