Edit report at http://bugs.php.net/bug.php?id=53642&edit=1
ID: 53642 Comment by: cornernote at gmail dot com Reported by: php at kingsquare dot nl Summary: CLI include_path bug Status: Open Type: Bug Package: *Configuration Issues Operating System: Windows 7 PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: >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 ]--- Previous Comments: ------------------------------------------------------------------------ [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 http://bugs.php.net/bug.php?id=53642&edit=1