Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.10.1
-
Component/s: None
-
Labels:None
Description
A number of ZF components, including Zend_Loader and Zend_Tool_Framework_Loader_IncludePathLoader, are not tolerant of the new PHP 5.3 phar:// paths.
Zend_Tool_Framework_Loader_IncludePathLoader::_getFiles() example:
$paths = explode(PATH_SEPARATOR, get_include_path());
An include path of 'phar://foo/bar.phar:.:/usr/lib/php' will result in $paths looking like this:
Array
(
[0] => phar
[1] => //foo/bar.phar
[2] => .
[3] => /usr/lib/php
)
For ZF to support environments where phars are used in the include path, we may no longer explode on PATH_SEPARATOR. Instead, we now need to step through the include_path string more carefully, like this:
// step through inc path, beware of phar://
$incpath = get_include_path();
$paths = array();
$offset = 0;
while ($pos = strpos($incpath, ':', $offset)) {
$chunk = substr($incpath, 0, $pos);
if ($chunk == 'phar') {
++$offset;
continue;
}
$offset = 0;
$paths[] = $chunk;
$incpath = substr($incpath, $pos+1);
}
// catch the last one which no longer has
// a PATH_SEPARATOR in it
if (! empty($incpath)) {
$paths[] = $incpath;
}
unset($incpath, $offset, $chunk);
That results in $paths looking like this:
Array
(
[0] => phar://foo/bar.phar
[1] => .
[2] => /usr/lib/php
)
Updated suggested fix to populate $incpath variable.