Bug #61317 [Com]: phar locations in include_path are ignored
| From: | stawi at plusnet dot pl | Date: | Wed, 20 Jun 2012 07:31:00 +0000 |
| Subject: | Bug #61317 [Com]: phar locations in include_path are ignored | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171381@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61317&edit=1
ID: 61317
Comment by: stawi at plusnet dot pl
Reported by: staff at pro-unreal dot de
Summary: phar locations in include_path are ignored
Status: Open
Type: Bug
Package: PHAR related
Operating System: Linux
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
Isnt this related to fact that PATH_SEPARATOR is ":" which occurs in "phar://" ?
Try this:
set_include_path('phar://my.phar/lib:/usr/share/php');
var_export(explode(PATH_SEPARATOR, get_include_path()));
And the result is: array(
0 => 'phar',
1 => '//my.phar/lib',
2 => '/usr/share/php',
)
Not shure how it works inside, but for PHP programmer it inconvenient...
Some frameworks uses autoloaders which do explode() and then foreach array to find file.
I know that changing PATH_SEPARATOR to other char can break a lot of code where it was hardcored as
":", but if constans exists one should use it ;)
Previous Comments:
------------------------------------------------------------------------
[2012-03-07 10:16:29] staff at pro-unreal dot de
Also applies for full phar URLs (Assuming the phar exists and contains the described files).
Replace phar://my.phar/lib with full url like phar:///tmp/my.phar/lib
------------------------------------------------------------------------
[2012-03-07 10:11:28] staff at pro-unreal dot de
Description:
------------
When including files from outside a Phar all phar:// locations in include path are ignored.
Test script:
---------------
include_path = phar://my.phar/lib:/usr/share/php
phar://my.phar/lib/Foo/Bar.php:
<?php
echo 'YES: ' . __FILE__;
?>
/usr/share/php/Foo/Bar.php
<?php
echo 'You should not see this!'
?>
Test /tmp/test.php:
<?php
include 'Foo/Bar.php'
?>
php -d include_path='phar://my.phar/lib:/usr/share/php' /tmp/test.php
Expected result:
----------------
Output should be:
YES: phar://my.phar/lib/Foo/Bar.php
Actual result:
--------------
Output is:
You should not see this!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61317&edit=1