com php-src: gettype(): Use "resource (closed)" instead of "unknown type": UPGRADING ext/standard/tests/general_functions/type.phpt
ext/standard/type.c

From: Date: Mon, 15 Aug 2016 21:12:24 +0000
Subject: com php-src: gettype(): Use "resource (closed)" instead of "unknown type": UPGRADING ext/standard/tests/general_functions/type.phpt
ext/standard/type.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93794@lists.php.net to get a copy of this message
Commit: 34824b70f8e72b200d77957145bb61883b03322d Author: Nikita Popov <nikic@php.net> Fri, 22 Jul 2016 19:16:43 +0200 Parents: 0374a98e1457105d884be324518a5f6a8c283234 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34824b70f8e72b200d77957145bb61883b03322d Log: gettype(): Use "resource (closed)" instead of "unknown type" Changed paths: M UPGRADING M ext/standard/tests/general_functions/type.phpt M ext/standard/type.c Diff: diff --git a/UPGRADING b/UPGRADING index 18b6c67..83942ba 100644 --- a/UPGRADING +++ b/UPGRADING @@ -20,6 +20,8 @@ PHP 7.1 UPGRADE NOTES ======================================== - Core: + . gettype() will now return "resource (closed)" instead of "unknown type" for + closed resources. ======================================== 2. New Features diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt index eb6f067..df2dbaf 100644 --- a/ext/standard/tests/general_functions/type.phpt +++ b/ext/standard/tests/general_functions/type.phpt @@ -63,7 +63,7 @@ string(6) "double" string(4) "NULL" string(7) "boolean" string(6) "string" -string(12) "unknown type" +string(17) "resource (closed)" string(8) "resource" string(6) "object" bool(true) diff --git a/ext/standard/type.c b/ext/standard/type.c index 3f97bc8..59268c7 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -59,17 +59,6 @@ PHP_FUNCTION(gettype) case IS_OBJECT: RETVAL_STRING("object"); - /* - { - char *result; - int res_len; - - res_len = sizeof("object of type ")-1 + Z_OBJCE_P(arg)->name_length; - spprintf(&result, 0, "object of type %s", Z_OBJCE_P(arg)->name); - RETVAL_STRINGL(result, res_len); - efree(result); - } - */ break; case IS_RESOURCE: @@ -78,8 +67,10 @@ PHP_FUNCTION(gettype) if (type_name) { RETVAL_STRING("resource"); - break; + } else { + RETVAL_STRING("resource (closed)"); } + break; } default:

« previous php.cvs (#93794) next »