Skip to content

Commit aa1b206

Browse files
author
Ilia Alshanetsky
committed
Fixed crash demonstrated with ext/dom/tests/dom003.phpt test case.
1 parent 036e8de commit aa1b206

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Zend/zend_default_classes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
481481
EG(exception) = NULL;
482482

483483
MAKE_STD_ZVAL(str);
484-
handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC);
485-
486-
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);
484+
if (handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC) != FAILURE) {
485+
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);
486+
}
487487
zval_ptr_dtor(&str);
488488

489489
if (EG(exception)) {

Zend/zend_exceptions.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ ZEND_API void zend_exception_error(zval *exception TSRMLS_DC)
481481
EG(exception) = NULL;
482482

483483
MAKE_STD_ZVAL(str);
484-
handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC);
485-
486-
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);
484+
if (handler->cast_object(exception, str, IS_STRING, 0 TSRMLS_CC) != FAILURE) {
485+
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);
486+
}
487487
zval_ptr_dtor(&str);
488488

489489
if (EG(exception)) {

0 commit comments

Comments
 (0)