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;