Bug #73702 [Opn]: get_resource_type returns NULL instead of false

From: Date: Fri, 09 Dec 2016 23:16:48 +0000
Subject: Bug #73702 [Opn]: get_resource_type returns NULL instead of false
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14203@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 Type: Bug Package: Documentation problem Operating System: irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: If zend_parse_paramters() fails, it is customary to simply return, what results in NULL, so in my opinion, this is a documentation bug. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#14203) next »