Bug #79370 [NEW]: Comparison problem
| From: | danil at pyatnitsev dot ru | Date: | Thu, 12 Mar 2020 09:13:50 +0000 |
| Subject: | Bug #79370 [NEW]: Comparison problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226047@lists.php.net to get a copy of this message | ||
From: danil at pyatnitsev dot ru
Operating system: Debian
PHP version: 7.4.3
Package: Variables related
Bug Type: Bug
Bug description:Comparison problem
Description:
------------
Incorrect comparison after addition float with integer
Test script:
---------------
<?php
$foo = (float) 32.77;
$bar = (float) 31.77;
$bar += 1;
var_dump($foo == $bar); // false
var_dump($foo, $bar); // float(32.77) float(32.77)
Expected result:
----------------
var_dump($foo == $bar); should be true in this case
Actual result:
--------------
It prints false
--
Edit bug report at https://bugs.php.net/bug.php?id=79370&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79370&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79370&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79370&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79370&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79370&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79370&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79370&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79370&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79370&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79370&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79370&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79370&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79370&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79370&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79370&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79370&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79370&r=mysqlcfg