Fix error message.

This commit is contained in:
CismonX 2018-03-29 16:04:29 +08:00
parent df3da628ee
commit a7a39c889a
1 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@
#define ERR_BAD_KEY_TYPE() PHP_COLLECTIONS_ERROR(E_WARNING, "Key must be integer or string") #define ERR_BAD_KEY_TYPE() PHP_COLLECTIONS_ERROR(E_WARNING, "Key must be integer or string")
#define ERR_BAD_CALLBACK_RETVAL() PHP_COLLECTIONS_ERROR(E_WARNING, "Bad callback return value") #define ERR_BAD_CALLBACK_RETVAL() PHP_COLLECTIONS_ERROR(E_WARNING, "Bad callback return value")
#define ERR_BAD_SIZE() PHP_COLLECTIONS_ERROR(E_WARNING, "Size must be non-negative") #define ERR_BAD_SIZE() PHP_COLLECTIONS_ERROR(E_WARNING, "Size must be non-negative")
#define ERR_NOT_ARITHMETIC() PHP_COLLECTIONS_ERROR(E_WARNING, "Elements should be int or double")
#define ELEMENTS_VALIDATE(elements) \ #define ELEMENTS_VALIDATE(elements) \
if (IS_COLLECTION_P(elements)) { \ if (IS_COLLECTION_P(elements)) { \
@ -289,7 +290,7 @@ PHP_METHOD(Collection, average)
else if (Z_TYPE_P(val) == IS_DOUBLE) else if (Z_TYPE_P(val) == IS_DOUBLE)
sum += Z_DVAL_P(val); sum += Z_DVAL_P(val);
else { else {
ERR_BAD_ARGUMENT_TYPE(); ERR_NOT_ARITHMETIC();
RETURN_NULL(); RETURN_NULL();
} }
ZEND_HASH_FOREACH_END(); ZEND_HASH_FOREACH_END();