Bug #69226 [NEW]: FILTER_VALIDATE_FLOAT treats integers as floats
From: ianbytchek at gmail dot com
Operating system: OS X 10.10.2
PHP version: 5.6.6
Package: Filter related
Bug Type: Bug
Bug description:FILTER_VALIDATE_FLOAT treats integers as floats
Description:
------------
I might be missing something here, but⦠Floats are numbers with a
floating point. For example:
```
$x = 10;
$x === (float) $x; // false
(float) $x === (float) $x; // true
```
But FILTER_VALIDATE_FLOAT treats integers as floats. Both examples below
must return false.
```
filter_var($x, FILTER_VALIDATE_FLOAT) // 10
filter_var('10', FILTER_VALIDATE_FLOAT) // 10
```
Also, why does filter convert value from string into an actual number?
Shouldn't that be done only by sanitize filters?
--
Edit bug report at https://bugs.php.net/bug.php?id=69226&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69226&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69226&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69226&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69226&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69226&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69226&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69226&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69226&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69226&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69226&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69226&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69226&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69226&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69226&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69226&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69226&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69226&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69226&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69226&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69226&r=mysqlcfg
Thread (2 messages)
- ianbytchek at gmail dot com