mirror of
https://github.com/php/php-src.git
synced 2026-04-23 07:58:20 +02:00
- Allow broken.dirnames to use phar too
- Add test - Kill MSVC compiler warning
This commit is contained in:
+1
-4
@@ -1606,7 +1606,7 @@ woohoo:
|
||||
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
|
||||
continue;
|
||||
}
|
||||
if (!memcmp(filename, key, keylen) && (filename_len == keylen
|
||||
if (!memcmp(filename, key, keylen) && ((uint)filename_len == keylen
|
||||
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
|
||||
if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
|
||||
break;
|
||||
@@ -1653,9 +1653,6 @@ next_extension:
|
||||
return SUCCESS;
|
||||
case FAILURE :
|
||||
/* look for more extensions */
|
||||
if (is_complete) {
|
||||
return FAILURE;
|
||||
}
|
||||
pos = strchr(pos + 1, '.');
|
||||
if (pos) {
|
||||
*ext_str = NULL;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Phar: create new Phar with broken.dirname in path
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
phar.require_hash=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dir = dirname(__FILE__) . '/broken.dirname';
|
||||
mkdir($dir, 0777);
|
||||
|
||||
$fname = $dir . '/dotted_path.phar';
|
||||
$stub = Phar::createDefaultStub();
|
||||
$file = $stub;
|
||||
|
||||
$files = array();
|
||||
$files['a'] = 'this is a';
|
||||
$files['b'] = 'this is b';
|
||||
|
||||
include 'files/phar_test.inc';
|
||||
|
||||
$phar = new Phar($fname);
|
||||
|
||||
foreach ($phar as $entry) {
|
||||
echo file_get_contents($entry)."\n";
|
||||
}
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/broken.dirname/dotted_path.phar');
|
||||
rmdir(dirname(__FILE__) . '/broken.dirname');
|
||||
?>
|
||||
--EXPECT--
|
||||
this is a
|
||||
this is b
|
||||
===DONE===
|
||||
Reference in New Issue
Block a user