summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-22 22:05:51 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-22 22:05:51 +0000
commitf7ce1d6260b8f6aee72e8f7bca5133ec0ce41a6b (patch)
treebaf3cb2dc48d13b400d7824c2f2c6d2385b68fd5
parent32f611097f68425f9ffa94b01ad361cc6e952d42 (diff)
downloadphp-git-f7ce1d6260b8f6aee72e8f7bca5133ec0ce41a6b.tar.gz
prevent segfault when exception is thrown from Countable::count()
-rw-r--r--ext/standard/array.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 03f6bfaafd..6cc929ba4b 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -312,8 +312,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