php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56650 Postive float returned when negative float given
Submitted: 2005-11-14 18:50 UTC Modified: 2005-11-16 18:57 UTC
From: ramsey@php.net Assigned: derick (profile)
Status: Closed Package: filter (PECL)
PHP Version: Irrelevant OS: -
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ramsey@php.net
New email:
PHP Version: OS:

 

 [2005-11-14 18:50 UTC] ramsey@php.net
Description:
------------
When passing a negative float to filter_data() and filtering on FL_FLOAT, a positive float is returned. It should return a negative float like FL_INT does for integers.

(I have a patch for this that I will submit.)

Reproduce code:
---------------
<?php
$float = '-34.78';

var_dump(filter_data($float, FL_FLOAT));
?>

Expected result:
----------------
float(-34.78)

Actual result:
--------------
float(34.78)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-14 19:16 UTC] ramsey@php.net
Index: logical_filters.c
===================================================================
RCS file: /repository/pecl/filter/logical_filters.c,v
retrieving revision 1.8
diff -u -u -r1.8 logical_filters.c
--- logical_filters.c	28 Sep 2005 09:14:43 -0000	1.8
+++ logical_filters.c	14 Nov 2005 23:33:44 -0000
@@ -240,6 +240,7 @@
 	}
 
 stateR: /* state 'return' */
+    ctx_value *= ctx_multiply;
 	Z_TYPE_P(value) = IS_DOUBLE;
 	Z_DVAL_P(value) = ctx_value;
 	return;
 [2005-11-16 18:57 UTC] sniper@php.net
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: Fri Dec 06 17:01:27 2024 UTC