From: Antony Dovgal Date: Wed, 22 Mar 2006 22:06:08 +0000 (+0000) Subject: MF51: prevent segfault when exception is thrown from Countable::count() X-Git-Tag: RELEASE_1_3~307 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=932c5d9e0e57d8222c8ef341aea6f68f35978747;p=php MF51: prevent segfault when exception is thrown from Countable::count() --- diff --git a/ext/standard/array.c b/ext/standard/array.c index af64947fdd..3ae61a4973 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -318,8 +318,10 @@ PHP_FUNCTION(count) if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); - RETVAL_LONG(Z_LVAL_P(retval)); - zval_ptr_dtor(&retval); + if (retval) { + RETVAL_LONG(Z_LVAL_P(retval)); + zval_ptr_dtor(&retval); + } return; } #endif