]> granicus.if.org Git - php/commitdiff
- MF53 dotted.path support
authorSteph Fox <sfox@php.net>
Tue, 13 May 2008 18:43:18 +0000 (18:43 +0000)
committerSteph Fox <sfox@php.net>
Tue, 13 May 2008 18:43:18 +0000 (18:43 +0000)
ext/phar/phar.c
ext/phar/tests/phar_dotted_path.phpt [new file with mode: 0644]

index dc0ec17960061d96d0d531d26b5703b7b9f85de2..50a8d600260feb1dbccbdb99b86cabbebe667032 100644 (file)
@@ -1606,7 +1606,7 @@ woohoo:
                                        zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
                                        continue;
                                }
-                               if (!memcmp(filename, key.s, keylen) && (filename_len == keylen
+                               if (!memcmp(filename, key.s, 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;
diff --git a/ext/phar/tests/phar_dotted_path.phpt b/ext/phar/tests/phar_dotted_path.phpt
new file mode 100644 (file)
index 0000000..823196f
--- /dev/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===