Bug #78893 [Com]: Inconsistent return value of gettype
Edit report at https://bugs.php.net/bug.php?id=78893&edit=1
ID: 78893
Comment by: sdsdsdsdsd at sdfdfdfdfdfdf dot net
Reported by: gmblar+php at gmail dot com
Summary: Inconsistent return value of gettype
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:
yeah, to late now, smart development would have leaded in calling the scalar types
'boolean', 'integer', and 'double' for the sake of consistency, but
hesy it's PHP
Previous Comments:
------------------------------------------------------------------------
[2019-11-30 20:15:08] requinix@php.net
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.
------------------------------------------------------------------------
[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
Thread (4 messages)