From: Jeroen van Wolffelaar Date: Sat, 22 Sep 2001 01:39:14 +0000 (+0000) Subject: Let settype also accept 'int', 'bool', 'float' and 'null' X-Git-Tag: PRE_SUBST_Z_MACROS~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=929ae94c64c71fcbed8e4cecdb6d09398d61e079;p=php Let settype also accept 'int', 'bool', 'float' and 'null' @Let settype also accept 'int', 'bool', 'float' and 'null' (Jeroen) --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 5713c61598..8c6cdf8d0e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1443,7 +1443,11 @@ PHP_FUNCTION(settype) if (!strcasecmp(new_type, "integer")) { convert_to_long(*var); - } else if (!strcasecmp(new_type, "double")) { + } else if (!strcasecmp(new_type, "int")) { + convert_to_long(*var); + } else if (!strcasecmp(new_type, "float")) { + convert_to_double(*var); + } else if (!strcasecmp(new_type, "double")) { /* deprecated */ convert_to_double(*var); } else if (!strcasecmp(new_type, "string")) { convert_to_string(*var); @@ -1451,8 +1455,12 @@ PHP_FUNCTION(settype) convert_to_array(*var); } else if (!strcasecmp(new_type, "object")) { convert_to_object(*var); + } else if (!strcasecmp(new_type, "bool")) { + convert_to_boolean(*var); } else if (!strcasecmp(new_type, "boolean")) { convert_to_boolean(*var); + } else if (!strcasecmp(new_type, "null")) { + convert_to_null(*var); } else if (!strcasecmp(new_type, "resource")) { php_error(E_WARNING, "settype: cannot convert to resource type"); RETURN_FALSE;