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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martijn at openbsd dot org
New email:
PHP Version: OS:

 

 [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)

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 05:01:42 2025 UTC