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

 ID:                 60794
 Comment by:         mattfic...@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:

I can't reproduce this error with 5.3.8-TS or 5.3.14rc2-NTS on Windows 7. I've 
posted the output of the test script above for 5.3.8-TS.

The test script doesn't pass regardless of turning off the str_pad calls. Could 
there be something wrong with the 2 phar files themselves?

What INI directives are you using? 

The PHAR section of my INI file is:
[Phar]
;phar.readonly = On
; http://php.net/phar.require-hash
;phar.require_hash = On
;phar.cache_list =

I am using the official 5.3.8 build, which has PHAR builtin.

With both set_include_path() calls commented out (ie it should work):
PHP Warning:  include(autoload/autoload.php): failed to open stream: No such fil
e or directory in C:\php-sdk\php-5.3.8-Win32-VC9-x86\60794.php on line 17

Warning: include(autoload/autoload.php): failed to open stream: No such file or
directory in C:\php-sdk\php-5.3.8-Win32-VC9-x86\60794.php on line 17
PHP Warning:  include(): Failed opening 'autoload/autoload.php' for inclusion (i
nclude_path='.;C:\php\pear') in C:\php-sdk\php-5.3.8-Win32-VC9-x86\60794.php on
line 17

Warning: include(): Failed opening 'autoload/autoload.php' for inclusion (includ
e_path='.;C:\php\pear') in C:\php-sdk\php-5.3.8-Win32-VC9-x86\60794.php on line
17
PHP Fatal error:  Call to undefined function autoload() in C:\php-sdk\php-5.3.8-
Win32-VC9-x86\60794.php on line 20

Fatal error: Call to undefined function autoload() in C:\php-sdk\php-5.3.8-Win32
-VC9-x86\60794.php on line 20

With the second set_include_path() call uncommented (so it should fail), I get:
included file phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/libA.phar/libA/libA.phpP
HP Warning:  include(libA/libA.php): failed to open stream: No such file or dire
ctory in phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autolo
ad.php on line 5

Warning: include(libA/libA.php): failed to open stream: No such file or director
y in phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.p
hp on line 5
PHP Warning:  include(): Failed opening 'libA/libA.php' for inclusion (include_p
ath='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaa;phar://libA.phar;phar://autoload.phar') in phar://C:/
php-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.php on line 5

Warning: include(): Failed opening 'libA/libA.php' for inclusion (include_path='
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa;phar://libA.phar;phar://autoload.phar') in phar://C:/php-s
dk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.php on line 5

With the 2nd set_include_path() commented out and the 1st uncommented (so it 
should pass), instead I get:
included file phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/libA.phar/libA/libA.phpP
HP Warning:  include(libA/libA.php): failed to open stream: No such file or dire
ctory in phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autolo
ad.php on line 5

Warning: include(libA/libA.php): failed to open stream: No such file or director
y in phar://C:/php-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.p
hp on line 5
PHP Warning:  include(): Failed opening 'libA/libA.php' for inclusion (include_p
ath='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaa;phar://libA.phar;phar://autoload.phar') in phar://C:/p
hp-sdk/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.php on line 5

Warning: include(): Failed opening 'libA/libA.php' for inclusion (include_path='
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa;phar://libA.phar;phar://autoload.phar') in phar://C:/php-sd
k/php-5.3.8-Win32-VC9-x86/autoload.phar/autoload/autoload.php on line 5


Previous Comments:
------------------------------------------------------------------------
[2012-06-04 17:01:49] paj...@php.net

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.

------------------------------------------------------------------------
[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

Reply via email to