summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index bd2823a407..f99af84611 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -740,11 +740,6 @@ PHP_FUNCTION(count)
}
switch (Z_TYPE_P(array)) {
- case IS_NULL:
- /* Intentionally not converted to an exception */
- php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array));
- RETURN_LONG(0);
- break;
case IS_ARRAY:
if (mode != COUNT_RECURSIVE) {
cnt = zend_array_count(Z_ARRVAL_P(array));
@@ -774,18 +769,11 @@ PHP_FUNCTION(count)
}
return;
}
-
- /* If There's no handler and it doesn't implement Countable then add a warning */
- /* Intentionally not converted to an exception */
- php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array));
- RETURN_LONG(1);
- break;
}
+ /* fallthrough */
default:
- /* Intentionally not converted to an exception */
- php_error_docref(NULL, E_WARNING, "%s(): Argument #1 ($var) must be of type Countable|array, %s given", get_active_function_name(), zend_zval_type_name(array));
- RETURN_LONG(1);
- break;
+ zend_argument_type_error(1, "must be of type Countable|array, %s given", zend_zval_type_name(array));
+ RETURN_THROWS();
}
}
/* }}} */