gettype(): Use "resource (closed)" instead of "unknown type"

This commit is contained in:
Nikita Popov 2016-07-22 19:16:43 +02:00
parent 0374a98e14
commit 34824b70f8
3 changed files with 6 additions and 13 deletions

View File

@ -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

View File

@ -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)

View File

@ -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: