]> granicus.if.org Git - php/commitdiff
Support resource type in gettype()
authorAndi Gutmans <andi@php.net>
Sun, 1 Aug 1999 17:56:09 +0000 (17:56 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 1 Aug 1999 17:56:09 +0000 (17:56 +0000)
ext/standard/basic_functions.c
tests/testobj

index 445036155d7ec45e1b7bf0c15dfc986406acc487..6fed8a31bb2d9d96dffa266a89ca002816a68087 100644 (file)
@@ -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;
index 28ac711b1971f85bbc1381b43b8a608a9c128cf9..661684be9186ddd5baf6f2ffb872c9813ab3b62d 100644 (file)
@@ -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");