Bug->Doc #73702 [Opn->Csd]: get_resource_type returns NULL instead of false
| From: | cmb@php.net | Date: | Sat, 28 Jan 2017 15:28:43 +0000 |
| Subject: | Bug->Doc #73702 [Opn->Csd]: get_resource_type returns NULL instead of false | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14386@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73702&edit=1
ID: 73702
Updated by: cmb@php.net
Reported by: martijn at openbsd dot org
Summary: get_resource_type returns NULL instead of false
-Status: Open
+Status: Closed
-Type: Bug
+Type: Documentation Problem
-Package: Documentation problem
+Package: Variables related
Operating System: irrelevant
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-01-28 15:27:51] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=341792
Log: Fix #73702: get_resource_type returns NULL instead of false
------------------------------------------------------------------------
[2016-12-09 23:16:47] cmb@php.net
If zend_parse_paramters() fails, it is customary to simply return, what results in NULL, so in my
opinion, this is a documentation bug.
------------------------------------------------------------------------
[2016-12-09 14:21:09] martijn at openbsd dot org
Description:
------------
According to http://php.net/manual/en/function.get-resource-type.php
get_resource_type should return FALSE if $handle is not a resource, but it returns NULL.
I reckon that returning false is the proper response and that following the documentation is the
more sane option.
Test script:
---------------
<?php
var_dump(@get_resource_type("not_a_resource"));
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73702&edit=1