From 25b95e4250fe197621e8c897b3819a9016dbd927 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Fri, 17 Mar 2006 23:00:20 +0000 Subject: [PATCH] Make is_string() return TRUE for both Unicode and binary strings. --- ext/standard/type.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ext/standard/type.c b/ext/standard/type.c index 4688c99172..805b951bf4 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -294,10 +294,21 @@ PHP_FUNCTION(is_binary) /* }}} */ /* {{{ proto bool is_string(mixed var) - Returns true if variable is a string */ + Returns true if variable is a Unicode or binary string */ PHP_FUNCTION(is_string) { - php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, UG(unicode) ? IS_UNICODE : IS_STRING); + zval **arg; + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only one argument expected"); + RETURN_FALSE; + } + + if (Z_TYPE_PP(arg) == IS_UNICODE || Z_TYPE_PP(arg) == IS_STRING) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } } /* }}} */ -- 2.50.1