count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
+ if (UNEXPECTED(EG(exception))) {
+ count = 0;
+ break;
+ }
}
/* if not and the object implements Countable we call its count() method */
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
+ if (UNEXPECTED(EG(exception))) {
+ count = 0;
+ break;
+ }
}
/* if not and the object implements Countable we call its count() method */
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
+ if (UNEXPECTED(EG(exception))) {
+ count = 0;
+ break;
+ }
}
/* if not and the object implements Countable we call its count() method */
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
+ if (UNEXPECTED(EG(exception))) {
+ count = 0;
+ break;
+ }
}
/* if not and the object implements Countable we call its count() method */
/* first, we check if the handler is defined */
if (Z_OBJ_HT_P(array)->count_elements) {
RETVAL_LONG(1);
- if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) {
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) {
return;
}
+ if (EG(exception)) {
+ return;
+ }
}
/* if not and the object implements Countable we call its count() method */
if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {