From: Sara Golemon Date: Mon, 25 Sep 2006 01:37:55 +0000 (+0000) Subject: Make settype($var, 'string'); behave like $var = (string)$var; X-Git-Tag: RELEASE_1_0_0RC1~1556 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=406f600d01051b0dc86dfff3cee00aa2d0baa428;p=php Make settype($var, 'string'); behave like $var = (string)$var; e.g. switch between (binary) and (unicode) depending on UG(unicode) --- diff --git a/ext/standard/type.c b/ext/standard/type.c index ca27441583..85f283f93f 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -113,9 +113,15 @@ PHP_FUNCTION(settype) convert_to_double(*var); } else if (!strcasecmp(new_type, "double")) { /* deprecated */ convert_to_double(*var); - } else if (!strcasecmp(new_type, "string")) { + } else if (!strcasecmp(new_type, "binary")) { /* explicit binary cast */ convert_to_string(*var); - } else if (!strcasecmp(new_type, "unicode")) { + } else if (!strcasecmp(new_type, "string")) { /* runtime string type */ + if (UG(unicode)) { + convert_to_unicode(*var); + } else { + convert_to_string(*var); + } + } else if (!strcasecmp(new_type, "unicode")) { /* explicit unicode cast */ convert_to_unicode(*var); } else if (!strcasecmp(new_type, "array")) { convert_to_array(*var);