From 91ec4763fd7288ea908bd1f82ffd40649c2740fd Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sun, 1 Aug 1999 17:56:09 +0000 Subject: [PATCH] Support resource type in gettype() --- ext/standard/basic_functions.c | 8 ++++++++ tests/testobj | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 445036155d..6fed8a31bb 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1266,6 +1266,9 @@ PHP_FUNCTION(gettype) case IS_LONG: RETVAL_STRING("integer",1); break; + case IS_RESOURCE: + RETVAL_STRING("resource",1); + break; case IS_DOUBLE: RETVAL_STRING("double",1); break; @@ -1318,6 +1321,11 @@ PHP_FUNCTION(settype) convert_to_array(var); } else if (!strcasecmp(new_type, "object")) { convert_to_object(var); + } else if (!strcasecmp(new_type, "boolean")) { + convert_to_boolean(var); + } else if (!strcasecmp(new_type, "resource")) { + php3_error(E_WARNING, "settype: cannot convert to resource type"); + RETURN_FALSE; } else { php3_error(E_WARNING, "settype: invalid type"); RETURN_FALSE; diff --git a/tests/testobj b/tests/testobj index 28ac711b19..661684be91 100644 --- a/tests/testobj +++ b/tests/testobj @@ -2,7 +2,7 @@ define("endl","\n"); -if (1) { +//if (1) { class foobar { function foobar() { $this->initialized = 1; @@ -12,7 +12,7 @@ class foobar { class barbara extends foobar { }; -} +//} $name = "foobar"; $foo = new $name; // or die("Unable to construct foobar\n"); -- 2.50.1