com php-src: Fixed bug #77608: NEWS ext/standard/http.c ext/standard/tests/strings/bug77608.phpt
| From: | Nikita Popov | Date: | Tue, 12 Feb 2019 09:49:20 +0000 |
| Subject: | com php-src: Fixed bug #77608: NEWS ext/standard/http.c ext/standard/tests/strings/bug77608.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104587@lists.php.net to get a copy of this message | ||
Commit: 8e34de475699a4aa0fbc7b8430574b56dc839362
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 12 Feb 2019 10:49:20 +0100
Parents: b5cb3ac8ecab71bfe1eb7d5b2d7a48970e11a5b4
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8e34de475699a4aa0fbc7b8430574b56dc839362
Log:
Fixed bug #77608
Remove special handling of doubles and escape them as usual instead.
Bugs:
https://bugs.php.net/77608
Changed paths:
M NEWS
M ext/standard/http.c
A ext/standard/tests/strings/bug77608.phpt
Diff:
diff --git a/NEWS b/NEWS
index 533b04e..6fa2390 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP NEWS
- Standard:
. Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions).
(John Stevenson)
+ . Fixed bug #77608 (http_build_query doesn't encode "+" in a float number).
+ (Nikita)
07 Feb 2019, PHP 7.2.15
diff --git a/ext/standard/http.c b/ext/standard/http.c
index f73d4ca..c11c940 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -192,15 +192,6 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
case IS_TRUE:
smart_str_appendl(formstr, "1", sizeof("1")-1);
break;
- case IS_DOUBLE:
- {
- char *ekey;
- size_t ekey_len;
- ekey_len = spprintf(&ekey, 0, "%.*G", (int) EG(precision), Z_DVAL_P(zdata));
- smart_str_appendl(formstr, ekey, ekey_len);
- efree(ekey);
- }
- break;
default:
{
zend_string *ekey;
diff --git a/ext/standard/tests/strings/bug77608.phpt b/ext/standard/tests/strings/bug77608.phpt
new file mode 100644
index 0000000..77bfb74
--- /dev/null
+++ b/ext/standard/tests/strings/bug77608.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #77608: http_build_query doesn't encode "+" in a float number
+--FILE--
+<?php
+
+$a = ["x" => 1E+14, "y" => "1E+14"];
+echo http_build_query($a);
+
+?>
+--EXPECT--
+x=1.0E%2B14&y=1E%2B14