From: hostmaster at uuism dot net
Operating system: Fedora Core 4
PHP version: 5.2.6
PHP Bug Type: Directory function related
Bug description: No Warning with rewinddir_variation3.phpt
Description:
------------
When I run test ext/standard/tests/dir/rewinddir_variation3 with PHP
5.2.6, the test fails because the Warning is not returned:
When rewinddir() is executed with a file resource, PHP does not return an
Warning message.
The test expects that PHP will return "Warning: rewinddir(): %d is not a
valid Directory resource in %s on line %d"
Otherwise, the test results are fine.
Jim
Reproduce code:
---------------
<?php
/* Prototype : void rewinddir([resource $dir_handle])
* Description: Rewind dir_handle back to the start
* Source code: ext/standard/dir.c
* Alias to functions: rewind
*/
/*
* Pass a file pointer to rewinddir() to test behaviour
*/
echo "*** Testing rewinddir() : usage variations ***\n";
echo "\n-- Open a file using fopen --\n";
var_dump($fp = fopen(__FILE__, 'r'));
$result1 = fread($fp, 5);
var_dump(rewinddir($fp));
$result2 = fread($fp, 5);
echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
if ($result1 === $result2) {
echo "rewinddir() works on file pointers\n";
} else {
echo "rewinddir() does not work on file pointers\n";
}
?>
Expected result:
----------------
*** Testing rewinddir() : usage variations ***
-- Open a file using fopen --
resource(%d) of type (stream)
Warning: rewinddir(): %d is not a valid Directory resource in %s on line
%d
bool(false)
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() does not work on file pointers
Actual result:
--------------
*** Testing rewinddir() : usage variations ***
-- Open a file using fopen --
resource(5) of type (stream)
NULL
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() works on file pointers
--
Edit bug report at http://bugs.php.net/?id=46440&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46440&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46440&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46440&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46440&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46440&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46440&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46440&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46440&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46440&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46440&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46440&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46440&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46440&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46440&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46440&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46440&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46440&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46440&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46440&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46440&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46440&r=mysqlcfg