php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73702 get_resource_type returns NULL instead of false
Submitted: 2016-12-09 14:21 UTC Modified: 2017-01-28 15:28 UTC
From: martijn at openbsd dot org Assigned: cmb (profile)
Status: Closed Package: Variables related
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
 [2016-12-09 14:21 UTC] 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

Patches

get_resource_type_false (last revision 2016-12-09 14:21 UTC by martijn at openbsd dot org)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-09 23:16 UTC] 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.
 [2017-01-28 15:27 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=341792
Log: Fix #73702: get_resource_type returns NULL instead of false
 [2017-01-28 15:28 UTC] cmb@php.net
-Status: Open +Status: Closed -Type: Bug +Type: Documentation Problem -Package: Documentation problem +Package: Variables related -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 08:01:25 2019 UTC