Bug #75949 [NEW]: Variables have "hidden" values (tested 5.6, 7.0, 7.1)
| From: | me at superkot dot online | Date: | Sun, 11 Feb 2018 08:24:19 +0000 |
| Subject: | Bug #75949 [NEW]: Variables have "hidden" values (tested 5.6, 7.0, 7.1) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213910@lists.php.net to get a copy of this message | ||
From: me at superkot dot online
Operating system: Ubuntu, CentOS
PHP version: Irrelevant
Package: Math related
Bug Type: Bug
Bug description:Variables have "hidden" values (tested 5.6, 7.0, 7.1)
Description:
------------
Calculation results in number different from what can be seen (and what
should be).
Happens with 2263.20 or 2263.70 in the presented script example.
Test script:
---------------
<?php
$order_total = '2263.20';
$order_total_nocents = $order_total * 100;
echo $order_total . ' '. (int) $order_total . ' ' . $order_total_nocents
. ' '. (int) $order_total_nocents;
if ( $order_total_nocents != "226320" && $order_total_nocents != 226320
) {
echo '<br />Error! '. $order_total_nocents;
}
Expected result:
----------------
2263.20 2263 226320 226320
Actual result:
--------------
2263.20 2263 226320 226319
Error! 226320
--
Edit bug report at https://bugs.php.net/bug.php?id=75949&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75949&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75949&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75949&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75949&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75949&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75949&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75949&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75949&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75949&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75949&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75949&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75949&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75949&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75949&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75949&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75949&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75949&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75949&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75949&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75949&r=mysqlcfg