summaryrefslogtreecommitdiff
path: root/ext/mbstring/mbstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/mbstring.c')
-rw-r--r--ext/mbstring/mbstring.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 173539f4b8..516b614324 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -5027,27 +5027,15 @@ PHP_FUNCTION(mb_check_encoding)
RETURN_FALSE;
}
- switch(Z_TYPE_P(input)) {
- case IS_LONG:
- case IS_DOUBLE:
- case IS_NULL:
- case IS_TRUE:
- case IS_FALSE:
- RETURN_TRUE;
- break;
- case IS_STRING:
- if (!php_mb_check_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), enc ? ZSTR_VAL(enc): NULL)) {
- RETURN_FALSE;
- }
- break;
- case IS_ARRAY:
- if (!php_mb_check_encoding_recursive(HASH_OF(input), enc)) {
- RETURN_FALSE;
- }
- break;
- default:
- php_error_docref(NULL, E_WARNING, "Input is something other than scalar or array");
+ if (Z_TYPE_P(input) == IS_ARRAY) {
+ if (!php_mb_check_encoding_recursive(HASH_OF(input), enc)) {
RETURN_FALSE;
+ }
+ } else {
+ convert_to_string(input);
+ if (!php_mb_check_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), enc ? ZSTR_VAL(enc): NULL)) {
+ RETURN_FALSE;
+ }
}
RETURN_TRUE;
}