[PHP-BUG] Bug #75507 [NEW]: Cast in function
[email protected] ("ciloe at hotmail dot fr") Thu, 9 Nov 2017 14:03:48 GMT
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: ciloe at hotmail dot fr
Operating system:
PHP version: 7.1.11
Package: PHP Language Specification
Bug Type: Bug
Bug description:Cast in function
Description:
------------
Hi, when you want to set an hard pypage in a function to test if you
have a string/integer/float
The result of var_dump will be float(123) and not a typage error !!!
Test script:
---------------
function test (float $element)
{
var_dump($element);
}
test('123');
die;
Expected result:
----------------
Catchable fatal error: Argument 1 passed to test() must be an instance
of float, instance of string given
Actual result:
--------------
float(123)
--
Edit bug report at https://bugs.php.net/bug.php?id=75507&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75507&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75507&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75507&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75507&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75507&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75507&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75507&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75507&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75507&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75507&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75507&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75507&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75507&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75507&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75507&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75507&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75507&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75507&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75507&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75507&r=mysqlcfg