From: Xinchen Hui Date: Sun, 29 Jun 2014 14:56:27 +0000 (+0800) Subject: Fixed segfault in intlgregcal_create_instance X-Git-Tag: POST_PHPNG_MERGE~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=499293449bbd3ef2f7dd3e904ee1a469e4ea0433;p=php Fixed segfault in intlgregcal_create_instance --- diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index e08d263723..41e2735485 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -182,7 +182,8 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance) _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { - zend_object_store_ctor_failed(Z_OBJ(orig) TSRMLS_CC); + zval_dtor(&orig); + RETURN_NULL(); } } diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h index 4dd1508468..1b764a2ab1 100644 --- a/ext/intl/intl_data.h +++ b/ext/intl/intl_data.h @@ -69,6 +69,11 @@ typedef struct _intl_data { if( U_FAILURE( INTL_DATA_ERROR_CODE((obj)) ) ) \ { \ intl_errors_set_custom_msg( INTL_DATA_ERROR_P((obj)), msg, 0 TSRMLS_CC ); \ + /* yes, this is ugly, but it alreay is */ \ + if (return_value != getThis()) { \ + zval_dtor(return_value); \ + RETURN_NULL(); \ + } \ Z_OBJ_P(return_value) = NULL; \ return; \ }