php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57035 Input_get float error
Submitted: 2006-05-24 09:40 UTC Modified: 2006-05-25 09:29 UTC
From: dev at pixandlog dot com Assigned: pajoye (profile)
Status: Closed Package: filter (PECL)
PHP Version: Irrelevant OS: Gentoo 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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dev at pixandlog dot com
New email:
PHP Version: OS:

 

 [2006-05-24 09:40 UTC] dev at pixandlog dot com
Description:
------------
With those exemples, i have a return value false.
Here are my tests value :
42, -42, +42, .4, -.4, 1000000000000, -1000000000000

Why i ask this report because i find important to check 
float value with integer value.
Exemple : Calc program :
input text form : type 0.45
input text form : type 0.55
Choose add action = 1 //Perhaps ajax or javascript so i 
return 1 to program in form.
Or i choose to type '1' in input form.


Reproduce code:
---------------
<?php
//$_GET['myfloat0'] == '42';
//$_GET['myfloat1'] == '-.4';
$source = INPUT_GET;
$name = 'myfloat0';
$ret = input_get($source, $name, FILTER_VALIDATE_FLOAT);
var_dump($ret);

$source = INPUT_GET;
$name = 'myfloat1';
$ret = input_get($source, $name, FILTER_VALIDATE_FLOAT);
var_dump($ret);

?>


Expected result:
----------------
float(42)
float(-0.4)


Actual result:
--------------
bool(false)
bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-24 09:45 UTC] dev at pixandlog dot com
I add my all tests for help.
<input type="text" name="float0" value="42" />
<input type="text" name="float1" value="-42" />
<input type="text" name="float2" value="+42" />
<input type="text" name="float3" value="12.25" />
<input type="text" name="float4" value="+12.25" />
<input type="text" name="float5" value="-12.25" />
<input type="text" name="float6" value="12.2500" />
<input type="text" name="float7" value="0.02" />
<input type="text" name="float8" value="-0.02" />
<input type="text" name="float9" value="0." />
<input type="text" name="float10" value=".4" />
<input type="text" name="float11" value="-.4" />
<input type="text" name="float12" value="1000000000000" />
<input type="text" name="float13" 
value="1000000000000.1000000000000" />
<input type="text" name="float14" 
value="1000000000000.0000000000001" />
<input type="text" name="float15" 
value="-1000000000000" />
<input type="text" name="float16" value="abracadabra" />
<input type="text"<input type="text" name="float18" 
value="..5" />
 name="float17" value="0.0.5" />
<input type="text" name="float19" value="10.2e4" />
<input type="text" name="float20" value="10,4" />
 [2006-05-25 09:29 UTC] pierre dot php at gmail dot com
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC