From 406f600d01051b0dc86dfff3cee00aa2d0baa428 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Mon, 25 Sep 2006 01:37:55 +0000 Subject: [PATCH] Make settype($var, 'string'); behave like $var = (string)$var; e.g. switch between (binary) and (unicode) depending on UG(unicode) --- ext/standard/type.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); -- 2.50.1