From: Ilia Alshanetsky Date: Fri, 5 Dec 2003 01:44:45 +0000 (+0000) Subject: Fixed crash demonstrated with ext/dom/tests/dom003.phpt test case. X-Git-Tag: php-5.0.0b3RC1~303 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa1b20614baf2d7cbfe5366c21c0efe40a49f0cc;p=php Fixed crash demonstrated with ext/dom/tests/dom003.phpt test case. --- diff --git a/Zend/zend_default_classes.c b/Zend/zend_default_classes.c index 8fdb245cb3..2679f0a9b8 100644 --- a/Zend/zend_default_classes.c +++ b/Zend/zend_default_classes.c @@ -481,9 +481,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) EG(exception) = NULL; MAKE_STD_ZVAL(str); - handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC); - - zend_update_property_string(default_exception_ptr, exception, "string", sizeof("string")-1, EG(exception) ? Z_OBJCE_P(exception)->name : Z_STRVAL_P(str) TSRMLS_CC); + if (handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC) != FAILURE) { + zend_update_property_string(default_exception_ptr, exception, "string", sizeof("string")-1, EG(exception) ? Z_OBJCE_P(exception)->name : Z_STRVAL_P(str) TSRMLS_CC); + } zval_ptr_dtor(&str); if (EG(exception)) { diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 8fdb245cb3..2679f0a9b8 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -481,9 +481,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC) EG(exception) = NULL; MAKE_STD_ZVAL(str); - handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC); - - zend_update_property_string(default_exception_ptr, exception, "string", sizeof("string")-1, EG(exception) ? Z_OBJCE_P(exception)->name : Z_STRVAL_P(str) TSRMLS_CC); + if (handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC) != FAILURE) { + zend_update_property_string(default_exception_ptr, exception, "string", sizeof("string")-1, EG(exception) ? Z_OBJCE_P(exception)->name : Z_STRVAL_P(str) TSRMLS_CC); + } zval_ptr_dtor(&str); if (EG(exception)) {