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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 19:03:41 2022 UTC