Skip to content

Commit

Permalink
Support count_elements, the Countable::count internal representant
Browse files Browse the repository at this point in the history
  • Loading branch information
carusogabriel committed Jan 28, 2018
1 parent a05b25b commit 5cc4c91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5cc4c91

Please sign in to comment.