ID: 46443
User updated by: hostmaster at uuism dot net
Reported By: hostmaster at uuism dot net
Status: Bogus
Bug Type: Directory function related
Operating System: Fedora Core 4
PHP Version: 5.2.6
New Comment:
I'm having the same kind of results with
ext/standard/tests/dir/readdir_variation7.phpt.
Previous Comments:
------------------------------------------------------------------------
[2008-10-31 22:45:34] [EMAIL PROTECTED]
See Bug #46440. Thanks.
------------------------------------------------------------------------
[2008-10-31 22:38:12] hostmaster at uuism dot net
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 this bug report at http://bugs.php.net/?id=46443&edit=1