]> 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)
NEWS
ext/phar/phar_object.c
ext/phar/tests/bug54395.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 8332b18142554ca60ed0162776e7bb307aa29b64..fffb954dade3d7cf44b9dfe59019ff732c80a1e0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,10 @@ PHP                                                                        NEWS
 - PDO PostgreSQL driver:
   . Fixed bug #54318 (Non-portable grep option used in PDO pgsql
     configuration). (bwalton at artsci dot utoronto dot ca)
+    
+- Phar extension:
+  . Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters).
+    (Felipe)
 
 - SOAP extension:
   . Fixed bug #54312 (soap_version logic bug). (tom at samplonius dot org)
index c54f3312e6d5f80b8598d3b64ae10856cf105588..1c49b7f91382026ba614465954b96e3dd623fe26 100644 (file)
@@ -628,7 +628,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"