php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75485 rewinddir incorrect return type
Submitted: 2017-11-03 16:45 UTC Modified: 2018-01-26 09:27 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: erik at evanv dot nl Assigned: vrana (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.1.11 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: erik at evanv dot nl
New email:
PHP Version: OS:

 

 [2017-11-03 16:45 UTC] erik at evanv dot nl
Description:
------------
---
From manual page: http://www.php.net/function.rewinddir
---

return type is specified as void but it is false in case of errors:

php > var_dump(rewinddir(fopen('/tmp/', 'r')));
PHP Warning:  rewinddir(): 25 is not a valid Directory resource in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. rewinddir() php shell code:1
php shell code:1:
bool(false)


Test script:
---------------
var_dump(rewinddir(fopen('/tmp/', 'r')));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-26 09:25 UTC] vrana@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=343910
Log: Document rewinddir return value (bug #75485)
 [2018-01-26 09:27 UTC] vrana@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: vrana
 [2018-01-26 09:27 UTC] vrana@php.net
Added: "Returns NULL on success or FALSE on failure." I've kept the return type as void because PHP Manual documents only the main return type and doesn't put the information about functions returning FALSE in case of an error (which is very common) into the signature.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC