From:             hostmaster at uuism dot net
Operating system: Fedora Core 4
PHP version:      5.2.6
PHP Bug Type:     Directory function related
Bug description:  closedir DOES work for file resource

Description:
------------
When I run ext/standard/tests/dir/closedir_variation3.phpt with PHP 5.2.6,
the closedir() function works with a file resource.  This test script
expects it not to work, so the test fails.

I'm see this kind of test failure in a number of cases.

Is there some kind of configuration option for allowing php with sloppy
syntax?

Thanks.

Jim

PS.  This may the same issue as Bug #44246: closedir() accepts a file
resource opened by fopen()

Reproduce code:
---------------
<?php
/* Prototype  : void closedir([resource $dir_handle])
 * Description: Close directory connection identified by the dir_handle
 * Source code: ext/standard/dir.c
 * Alias to functions: close
 */

/*
 * Create a file pointer using fopen() then try to close it using
closedir()
 */

echo "*** Testing closedir() : usage variations ***\n";

echo "\n-- Open a file using fopen() --\n";
var_dump($fp = fopen(__FILE__, 'r'));

echo "\n-- Try to close the file pointer using closedir() --\n";
var_dump(closedir($fp));

echo "\n-- Check file pointer: --\n";
var_dump($fp);

if(is_resource($fp)) {
        fclose($fp);
}
?>


Expected result:
----------------
*** Testing closedir() : usage variations ***

-- Open a file using fopen() --
resource(%d) of type (stream)

-- Try to close the file pointer using closedir() --

Warning: closedir(): %d is not a valid Directory resource in %s on line
%d
bool(false)

-- Check file pointer: --
resource(%d) of type (stream)


Actual result:
--------------
*** Testing closedir() : usage variations ***

-- Open a file using fopen() --
resource(5) of type (stream)

-- Try to close the file pointer using closedir() --
NULL

-- Check file pointer: --
resource(5) of type (Unknown)


-- 
Edit bug report at http://bugs.php.net/?id=46443&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46443&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46443&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46443&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46443&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46443&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46443&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46443&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46443&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46443&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46443&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46443&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46443&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46443&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46443&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46443&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46443&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46443&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46443&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46443&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46443&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46443&r=mysqlcfg

Reply via email to