Bug #60794 [Opn]: Cannot include files from different .phars when include path is too long
| From: | pajoye@php.net | Date: | Mon, 04 Jun 2012 17:01:50 +0000 |
| Subject: | Bug #60794 [Opn]: Cannot include files from different .phars when include path is too long | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171027@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60794&edit=1
ID: 60794
Updated by: pajoye@php.net
Reported by: pdobrigkeit at gmx dot de
Summary: Cannot include files from different .phars when
include path is too long
Status: Open
Type: Bug
Package: PHAR related
Operating System: Windows 7
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
For the record here. This is certainly due to MAXPATHLEN check in the stream
implementation.
The question now is to verify where it fails, whether in stream core itself or in
phar. If the sooner, we have some kind of a problem here and could be harder to
solve.
Temporary work around would be to use aliases.
Previous Comments:
------------------------------------------------------------------------
[2012-04-12 21:11:35] alex dot bowyer at googlemail dot com
I have the same problem on PHP 5.3.10 / Windows Server 2008 / IIS 7.5.
We have a workaround for now but soon the 218 character limit is going to be an issue for us. Hope
you can fix it!
------------------------------------------------------------------------
[2012-01-19 10:39:19] s dot kleff at dershao dot de
Works as expected on PHP Version 5.3.8-ZS5.5.0 / Debian 2.6.32-5-amd64
------------------------------------------------------------------------
[2012-01-19 07:59:10] s dot kleff at dershao dot de
Same on PHP 5.3.8 on Win 7 64Bit
------------------------------------------------------------------------
[2012-01-18 18:27:10] pdobrigkeit at gmx dot de
Description:
------------
When including multiple .phar archieves into the code and one of the archieves contains for example
an autoloading script to include files, the script breaks when the reference to the phar wrapper is
too far back in the include path. It works anytime when using the phar:// wrapper and not when
referencing the file via the include path.
That is not helpful, when the provided autoloader of the framework does not care whether the file is
within a different .phar.
The two used .phars used can be downloaded here:
http://dl.dropbox.com/u/3319901/autoload.phar
http://dl.dropbox.com/u/3319901/libA.phar
Just put those into the root directory with the test script code. To build the .phars I used the
export functionality of Zend Studio, as well as a Phing target, both yielded the same results.
Test script:
---------------
<?php
$phars = array( 'phar://libA.phar',
'phar://autoload.phar');
$usedPath = implode(PATH_SEPARATOR, $phars);
//working with this include path length
//set_include_path(str_pad(PATH_SEPARATOR . $usedPath, 218, 'a', STR_PAD_LEFT));
//NOT working with this include path length
set_include_path(str_pad(PATH_SEPARATOR . $usedPath, 219, 'a', STR_PAD_LEFT));
include 'libA.phar';
include 'autoload.phar';
include 'autoload/autoload.php';
//works at any time
autoload('phar://libA.phar/libA/libA.php');
//NOT working when include path is too long
autoload('libA/libA.php');
Expected result:
----------------
included file phar://libA.phar/libA/libA.php
included file phar://libA.phar/libA/libA.php
Actual result:
--------------
included file phar://libA.phar/libA/libA.php
Warning: include() [function.include]: Failed opening 'libA/libA.php' for inclusion
(include_path='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;phar://libA.phar;phar://autoload.phar')
in phar://autoload.phar/autoload/autoload.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60794&edit=1