Bug #73380 [NEW]: Fatal error when passing function arguments with type-hinting
| From: | er dot haridarshan at gmail dot com | Date: | Mon, 24 Oct 2016 06:46:33 +0000 |
| Subject: | Bug #73380 [NEW]: Fatal error when passing function arguments with type-hinting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204980@lists.php.net to get a copy of this message | ||
From: er dot haridarshan at gmail dot com
Operating system: Fedora 24
PHP version: 7.0.12
Package: Compile Failure
Bug Type: Bug
Bug description:Fatal error when passing function arguments with type-hinting
Description:
------------
When arguments are type-hinted in function, PHP throw fatal error when
type-hint is double and boolean. In case of boolean, if it changes to
bool, It doesn't give any fatal error
Test script:
---------------
function test(array $a, string $b, int $c, float $d, double $e, boolean
$f)
{
echo "ok";
}
test(["1"], "string", 1, 1.2, (double)1.2, false);
Expected result:
----------------
Simply print output as "ok"
Actual result:
--------------
PHP Fatal error: Uncaught TypeError: Argument 5 passed to test() must
be an instance of double, float given
PHP Fatal error: Uncaught TypeError: Argument 6 passed to test() must
be an instance of boolean, boolean given
--
Edit bug report at https://bugs.php.net/bug.php?id=73380&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73380&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73380&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73380&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73380&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73380&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73380&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73380&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73380&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73380&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73380&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73380&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73380&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73380&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73380&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73380&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73380&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73380&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73380&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73380&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73380&r=mysqlcfg