From: Derick Rethans Date: Thu, 1 Apr 2004 08:54:44 +0000 (+0000) Subject: - Fixed bug #27822 (is_resource() returns TRUE for closed resources) X-Git-Tag: php-5.0.0RC2RC1~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88c17817a90e1c6a559ca128550b88ec0cd2171e;p=php - Fixed bug #27822 (is_resource() returns TRUE for closed resources) --- diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt new file mode 100644 index 0000000000..d44461e442 --- /dev/null +++ b/ext/standard/tests/general_functions/is_resource.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #27822: is_resource() returns TRUE for closed resources +--FILE-- + +--EXPECT-- +bool(false) diff --git a/ext/standard/type.c b/ext/standard/type.c index 296353decd..3005df1dce 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -218,6 +218,13 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) RETURN_FALSE; } } + if (type == IS_RESOURCE) { + char *type_name; + type_name = zend_rsrc_list_get_rsrc_type(Z_LVAL_PP(arg) TSRMLS_CC); + if (!type_name) { + RETURN_FALSE; + } + } RETURN_TRUE; } else { RETURN_FALSE;