From 5cc4c918acf5d70bd32a1b5888f8086ac2ef0451 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 22 Jan 2018 19:21:40 -0200 Subject: [PATCH] Support count_elements, the Countable::count internal representant --- Zend/zend_API.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cee68b0286ff6..8bbfb8e8ba9c7 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -4287,6 +4287,10 @@ ZEND_API zend_bool zend_is_countable(zval *countable) /* {{{ */ case IS_ARRAY: return 1; case IS_OBJECT: + if (Z_OBJ_HT_P(countable)->count_elements) { + return 1; + } + return instanceof_function(Z_OBJCE_P(countable), zend_ce_countable); default: return 0;