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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC