Bug #80011 [Opn->Nab]: Bug at cast type float
| From: | cmb@php.net | Date: | Mon, 24 Aug 2020 09:36:55 +0000 |
| Subject: | Bug #80011 [Opn->Nab]: Bug at cast type float | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228729@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80011&edit=1
ID: 80011
Updated by: cmb@php.net
Reported by: god6dog at gmail dot com
Summary: Bug at cast type float
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: linux
PHP Version: 7.4.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This has nothing to do with http_build_query, but is rather normal
behavior for floats[1]. If you need to preserve the two decimals,
just pass a string[2].
[1] <https://3v4l.org/FuC6Y>
[2] <https://3v4l.org/6kIsm>
Previous Comments:
------------------------------------------------------------------------
[2020-08-24 09:22:10] god6dog at gmail dot com
Changed description
------------------------------------------------------------------------
[2020-08-24 09:18:35] god6dog at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.http-build-query
---
float type with zero at the end is incorrectly converted
Test script:
---------------
Bug at cast type float:
php > echo http_build_query(['foo' => 123.00]);
foo=123
php > echo http_build_query(['foo' => 123.01]);
foo=123.01
Expected result:
----------------
php > echo http_build_query(['foo' => 123.00]);
foo=123.00
Actual result:
--------------
php > echo http_build_query(['foo' => 123.00]);
foo=123
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80011&edit=1