#46440 [Opn]: No Warning with rewinddir_variation3.phpt

From: Date: Fri, 31 Oct 2008 22:12:32 +0000
Subject: #46440 [Opn]: No Warning with rewinddir_variation3.phpt
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130379@lists.php.net to get a copy of this message
ID: 46440 User updated by: hostmaster at uuism dot net Reported By: hostmaster at uuism dot net Status: Open Bug Type: Directory function related Operating System: Fedora Core 4 PHP Version: 5.2.6 New Comment: I didn't notice that the rest of the expected results were different also. It appears that rewinddir() DOES work for file resources. Jim Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#130379) next »