]> granicus.if.org Git - php/commitdiff
Make is_string() return TRUE for both Unicode and binary strings.
authorAndrei Zmievski <andrei@php.net>
Fri, 17 Mar 2006 23:00:20 +0000 (23:00 +0000)
committerAndrei Zmievski <andrei@php.net>
Fri, 17 Mar 2006 23:00:20 +0000 (23:00 +0000)
ext/standard/type.c

index 4688c99172f24a049d340dbc30de910d6ebdd05a..805b951bf4333134334b767936e566e74f00a720 100644 (file)
@@ -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;
+       }
 }
 /* }}} */