From 929ae94c64c71fcbed8e4cecdb6d09398d61e079 Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Sat, 22 Sep 2001 01:39:14 +0000 Subject: [PATCH] Let settype also accept 'int', 'bool', 'float' and 'null' @Let settype also accept 'int', 'bool', 'float' and 'null' (Jeroen) --- ext/standard/basic_functions.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 5713c61598c..8c6cdf8d0e5 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;