derick          Thu Apr  1 03:54:44 2004 EDT

  Added files:                 
    /php-src/ext/standard/tests/general_functions       is_resource.phpt 

  Modified files:              
    /php-src/ext/standard       type.c 
  Log:
  - Fixed bug #27822 (is_resource() returns TRUE for closed resources)
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/type.c?r1=1.24&r2=1.25&ty=u
Index: php-src/ext/standard/type.c
diff -u php-src/ext/standard/type.c:1.24 php-src/ext/standard/type.c:1.25
--- php-src/ext/standard/type.c:1.24    Sun Mar 14 17:59:04 2004
+++ php-src/ext/standard/type.c Thu Apr  1 03:54:44 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: type.c,v 1.24 2004/03/14 22:59:04 helly Exp $ */
+/* $Id: type.c,v 1.25 2004/04/01 08:54:44 derick Exp $ */
 
 #include "php.h"
 #include "php_incomplete_class.h"
@@ -218,6 +218,13 @@
                                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;

http://cvs.php.net/co.php/php-src/ext/standard/tests/general_functions/is_resource.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/general_functions/is_resource.phpt
+++ php-src/ext/standard/tests/general_functions/is_resource.phpt
--TEST--
Bug #27822: is_resource() returns TRUE for closed resources
--FILE--
<?php
        $f = fopen(__FILE__, 'r');
        fclose($f);
        var_dump(is_resource($f));
?>
--EXPECT--
bool(false)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to