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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
19 - 14 = ?
Subscribe to this entry?

 
 [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
 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=b5de5957f5f7e4dcbeb2f3abba30830cdba17315
Log: Fix #73702: get_resource_type returns NULL instead of false
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC