ID:               46440
 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:

Can I test the solution with php5.2-200810312330 that I downloaded from
php-5.2-latest.gz?

I don't know what you mean by "that test isn't to 5.2.6."

Test rewinddir_variation3.phpt was part of the released package for
php-5.2.6, as were closedir_variation3.phpt and
readdir_variation7.phpt.

They all failed for similar reasons:  directory functions work for file
resources.

Thanks.

Jim


Previous Comments:
------------------------------------------------------------------------

[2008-10-31 22:32:41] [EMAIL PROTECTED]

Hello, that test isn't to 5.2.6. The bug was fixed in 5.2.7-RC1.

Thanks.

------------------------------------------------------------------------

[2008-10-31 22:13:18] hostmaster at uuism dot net

Updated Summary

------------------------------------------------------------------------

[2008-10-31 22:12:29] hostmaster at uuism dot net

I didn't notice that the rest of the expected results were different
also. 

It appears that rewinddir() DOES work for file resources.

Jim

------------------------------------------------------------------------

[2008-10-31 22:07:35] hostmaster at uuism dot net

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 this bug report at http://bugs.php.net/?id=46440&edit=1

Reply via email to