felipe                                   Sat, 26 Mar 2011 17:02:34 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=309716

Log:
- Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters)

Bug: http://bugs.php.net/54395 (error getting bug information)
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
    A   php/php-src/branches/PHP_5_3/ext/phar/tests/bug54395.phpt
    U   php/php-src/trunk/ext/phar/phar_object.c
    A   php/php-src/trunk/ext/phar/tests/bug54395.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-03-26 13:22:02 UTC (rev 309715)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-03-26 17:02:34 UTC (rev 309716)
@@ -38,6 +38,10 @@
 - 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)

Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-26 13:22:02 UTC 
(rev 309715)
+++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-26 17:02:34 UTC 
(rev 309716)
@@ -628,7 +628,7 @@
                }

                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)) {

Added: php/php-src/branches/PHP_5_3/ext/phar/tests/bug54395.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/tests/bug54395.phpt                   
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/phar/tests/bug54395.phpt   2011-03-26 
17:02:34 UTC (rev 309716)
@@ -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"

Modified: php/php-src/trunk/ext/phar/phar_object.c
===================================================================
--- php/php-src/trunk/ext/phar/phar_object.c    2011-03-26 13:22:02 UTC (rev 
309715)
+++ php/php-src/trunk/ext/phar/phar_object.c    2011-03-26 17:02:34 UTC (rev 
309716)
@@ -629,7 +629,7 @@
                }

                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)) {

Added: php/php-src/trunk/ext/phar/tests/bug54395.phpt
===================================================================
--- php/php-src/trunk/ext/phar/tests/bug54395.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/phar/tests/bug54395.phpt      2011-03-26 17:02:34 UTC 
(rev 309716)
@@ -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"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to