php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57044 Float exponential weird result
Submitted: 2006-05-26 09:20 UTC Modified: 2006-05-27 21:13 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
 [2006-05-26 09:20 UTC] dev at pixandlog dot com
Description:
------------
I try this code and my results are weird.

-- 
Reivax


Reproduce code:
---------------
<?php
//$_GET['float40'] = 'E2';
//$_GET['float41'] = '10E';
//$_GET['float42'] = '2E-';
//$_GET['float43'] = 'E-2';
//$_GET['float44'] = '+E2';

var_dump(filter_data($_GET['float40'], FILTER_VALIDATE_FLOAT));
var_dump(filter_data($_GET['float41'], FILTER_VALIDATE_FLOAT));
var_dump(filter_data($_GET['float42'], FILTER_VALIDATE_FLOAT));
var_dump(filter_data($_GET['float43'], FILTER_VALIDATE_FLOAT));
var_dump(filter_data($_GET['float44'], FILTER_VALIDATE_FLOAT));
?>


Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)


Actual result:
--------------
float(21) //float40
float(10) //float41
float(2) //float42
float(21) //float43
float(0) //float44


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-27 21:13 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.

Good catch, I simplified too much the case where a value begins with E.

However, I think the results should be valid, As they are with the (float)$string. Il ne faut pas etre plus catholique que le pape ;-)

Thanks for this report!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC