dsp                                      Tue, 27 Oct 2009 13:02:36 +0000

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

Log:
- Fixed bug #49142 (crash when exception thrown from __tostring())

Bug: http://bugs.php.net/49142 (Verified) crash when exception thrown from 
__tostring() (PHP_5_3 only!)
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/zend.c
    U   php/php-src/trunk/Zend/zend.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-10-27 12:56:49 UTC (rev 289986)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-10-27 13:02:36 UTC (rev 289987)
@@ -11,6 +11,8 @@
 - Fixed memory leak in extension loading when an error occurs on Windows.
   (Pierre)

+- Fixed bug #49142 (crash when exception thrown from __tostring()).
+  (David Soria Parra)
 - Fixed bug #49990 (SNMP3 warning message about security level printed twice).
   (Jani)
 - Fixed bug #49985 (pdo_pgsql prepare() re-use previous aborted

Modified: php/php-src/branches/PHP_5_3/Zend/zend.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend.c    2009-10-27 12:56:49 UTC (rev 
289986)
+++ php/php-src/branches/PHP_5_3/Zend/zend.c    2009-10-27 13:02:36 UTC (rev 
289987)
@@ -1067,10 +1067,16 @@
                        if (!EG(active_symbol_table)) {
                                zend_rebuild_symbol_table(TSRMLS_C);
                        }
-                       Z_ARRVAL_P(z_context) = EG(active_symbol_table);
-                       Z_TYPE_P(z_context) = IS_ARRAY;
-                       zval_copy_ctor(z_context);

+                       /* during shutdown the symbol table table can be still 
null */
+                       if (!EG(active_symbol_table)) {
+                               Z_TYPE_P(z_context) = IS_NULL;
+                       } else {
+                               Z_ARRVAL_P(z_context) = EG(active_symbol_table);
+                               Z_TYPE_P(z_context) = IS_ARRAY;
+                               zval_copy_ctor(z_context);
+                       }
+
                        params = (zval ***) emalloc(sizeof(zval **)*5);
                        params[0] = &z_error_type;
                        params[1] = &z_error_message;

Modified: php/php-src/trunk/Zend/zend.c
===================================================================
--- php/php-src/trunk/Zend/zend.c       2009-10-27 12:56:49 UTC (rev 289986)
+++ php/php-src/trunk/Zend/zend.c       2009-10-27 13:02:36 UTC (rev 289987)
@@ -1661,9 +1661,14 @@
                        if (!EG(active_symbol_table)) {
                                zend_rebuild_symbol_table(TSRMLS_C);
                        }
-                       Z_ARRVAL_P(z_context) = EG(active_symbol_table);
-                       Z_TYPE_P(z_context) = IS_ARRAY;
-                       zval_copy_ctor(z_context);
+                       /* during shutdown the symbol table table can be still 
null */
+                       if (!EG(active_symbol_table)) {
+                               Z_TYPE_P(z_context) = IS_NULL;
+                       } else {
+                               Z_ARRVAL_P(z_context) = EG(active_symbol_table);
+                               Z_TYPE_P(z_context) = IS_ARRAY;
+                               zval_copy_ctor(z_context);
+                       }

                        params = (zval ***) emalloc(sizeof(zval **)*5);
                        params[0] = &z_error_type;

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

Reply via email to