php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54146 0 not valid float
Submitted: 2011-03-03 02:23 UTC Modified: 2011-03-03 14:11 UTC
From: zb at nospam dot dk Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.3SVN-2011-03-03 (SVN) OS: OSX and Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zb at nospam dot dk
New email:
PHP Version: OS:

 

 [2011-03-03 02:23 UTC] zb at nospam dot dk
Description:
------------
---
From manual page: http://www.php.net/filter.filters.validate
---

As I understand the documentation, 0 (zero) should be a valid float, but it fails 
while testing.

Test script:
---------------
<?php
$var=0;

if (!filter_var($var, FILTER_VALIDATE_FLOAT))
{
echo "Not valid";
}
else
{
echo "Valid";
}

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-03 14:11 UTC] dtajchreber@php.net
-Status: Open +Status: Bogus
 [2011-03-03 14:11 UTC] dtajchreber@php.net
0 == false. Need to check return value a little more closely.

http://codepad.viper-7.com/U865Rf
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC