Req #79574 [NEW]: ReflectionType and gettype return different values
| From: | thomas dot wleight at googlemail dot com | Date: | Fri, 08 May 2020 13:07:48 +0000 |
| Subject: | Req #79574 [NEW]: ReflectionType and gettype return different values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226957@lists.php.net to get a copy of this message | ||
From: thomas dot wleight at googlemail dot com
Operating system:
PHP version: 7.3.17
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:ReflectionType and gettype return different values
Description:
------------
There is a difference in results.
ReflectionParameter getType() function returns "int".
But builtin function "gettype" returns "integer".
Just check the test script below.
Test script:
---------------
class A {
function f(int $a) {}
}
$r = new ReflectionClass("A");
$m = $r->getMethods();
$p = $m[0]->getParameters();
$t = $p[0]->getType();
echo $t; // "int"
echo PHP_EOL;
echo gettype(42); // "integer"
Expected result:
----------------
In both cases should return "integer"
Actual result:
--------------
ReflectionParameter returns "int" and gettype() returns "integer"
--
Edit bug report at https://bugs.php.net/bug.php?id=79574&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79574&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79574&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79574&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79574&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79574&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79574&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79574&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79574&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79574&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79574&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79574&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79574&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79574&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79574&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79574&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79574&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79574&r=mysqlcfg