Bug #78893 [Opn->Nab]: Inconsistent return value of gettype
| From: | requinix@php.net | Date: | Sat, 30 Nov 2019 20:15:08 +0000 |
| Subject: | Bug #78893 [Opn->Nab]: Inconsistent return value of gettype | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223974@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78893&edit=1
ID: 78893
Updated by: requinix@php.net
Reported by: gmblar+php at gmail dot com
Summary: Inconsistent return value of gettype
-Status: Open
+Status: Not a bug
Type: Bug
Package: Variables related
Operating System: MacOS 10.15.1
PHP Version: 7.4.0
Block user comment: N
Private report: N
New Comment:
The returned strings are perfectly adequate and have existed as such since forever. Changing it just
because scalar types use different names isn't a good enough reason to break BC.
Previous Comments:
------------------------------------------------------------------------
[2019-11-30 20:09:18] gmblar+php at gmail dot com
Description:
------------
Return value of gettype not match the names used as type hints of parameters, properties or
ReflectionType.
Test script:
---------------
var_dump(gettype(true));
var_dump(gettype(false));
var_dump(gettype(1337));
var_dump(gettype(23.42));
Expected result:
----------------
string(4) "bool"
string(4) "bool"
string(3) "int"
string(5) "float"
Actual result:
--------------
string(7) "boolean"
string(7) "boolean"
string(7) "integer"
string(6) "double"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78893&edit=1