Bug #71933 [NEW]: Is_int() applied a float cast is incorrect
| From: | daniel dot gimeno at gmail dot com | Date: | Thu, 31 Mar 2016 15:29:03 +0000 |
| Subject: | Bug #71933 [NEW]: Is_int() applied a float cast is incorrect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200269@lists.php.net to get a copy of this message | ||
From: daniel dot gimeno at gmail dot com
Operating system: Ubuntu 14.04
PHP version: 5.6.19
Package: *General Issues
Bug Type: Bug
Bug description:Is_int() applied a float cast is incorrect
Description:
------------
The problem is when a float cast it's applied to a variable.
Does not matter what is the value of that variable, is_int() will always
return a False result.
Test script:
---------------
$num = (float)2; //it's the same result for 0, 2, 2.0 or 2.3
$isint = is_int($num);
var_dump ($num);
var_dump($isint);
You get:
float(2)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=71933&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71933&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71933&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71933&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71933&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71933&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71933&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71933&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71933&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71933&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71933&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71933&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71933&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71933&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71933&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71933&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71933&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71933&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71933&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71933&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71933&r=mysqlcfg