]> granicus.if.org Git - php/commitdiff
- Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters)
authorFelipe Pena <felipe@php.net>
Sat, 26 Mar 2011 17:02:34 +0000 (17:02 +0000)
committerFelipe Pena <felipe@php.net>
Sat, 26 Mar 2011 17:02:34 +0000 (17:02 +0000)
ext/phar/phar_object.c
ext/phar/tests/bug54395.phpt [new file with mode: 0644]

index 732e6a3cd6a9e0de96ef0fe8aa83506e2d1d1176..afe12851b5cdc718bb126aac9c01a7a5128a757c 100644 (file)
@@ -629,7 +629,7 @@ carry_on:
                }
 
                return;
-       } else if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) {
+       } else if (PHAR_GLOBALS->phar_fname_map.arBuckets && SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) {
                goto carry_on;
        } else if (PHAR_G(manifest_cached) && SUCCESS == zend_hash_find(&cached_phars, fname, fname_len, (void **)&pphar)) {
                if (SUCCESS == phar_copy_on_write(pphar TSRMLS_CC)) {
diff --git a/ext/phar/tests/bug54395.phpt b/ext/phar/tests/bug54395.phpt
new file mode 100644 (file)
index 0000000..091ed32
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Bug #54395 (Phar::mount() crashes when calling with wrong parameters)
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+--FILE--
+<?php
+
+try {
+       phar::mount(1,1);
+} catch (Exception $e) {
+       var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(25) "Mounting of 1 to 1 failed"