Bug #79641 [NEW]: Type cast problem
| From: | mr dot vladkuz at gmail dot com | Date: | Wed, 27 May 2020 12:12:30 +0000 |
| Subject: | Bug #79641 [NEW]: Type cast problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-227197@lists.php.net to get a copy of this message | ||
From: mr dot vladkuz at gmail dot com
Operating system: Centos 7, macos
PHP version: 7.4.6
Package: *General Issues
Bug Type: Bug
Bug description:Type cast problem
Description:
------------
One bit is lost when using typed parameters function.
This occurs for 2^18-2^19.
Test script:
---------------
class TypeHintEvil
{
private $num;
public function getNum(): int
{
return $this->num;
}
public function setNum(int $num): void
{
$this->num = $num;
}
}
$evil = new TypeHintEvil();
$evil->setNum(4860.98 * 100);
echo $evil->getNum(); //486097
Expected result:
----------------
486098
Actual result:
--------------
486097
--
Edit bug report at https://bugs.php.net/bug.php?id=79641&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79641&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79641&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79641&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79641&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79641&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79641&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79641&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79641&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79641&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79641&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79641&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79641&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79641&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79641&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79641&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79641&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79641&r=mysqlcfg