1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
diff --git a/hphp/runtime/ext/url/ext_url.cpp b/hphp/runtime/ext/url/ext_url.cpp
index e58b63c..355ac77 100644
--- a/hphp/runtime/ext/url/ext_url.cpp
+++ b/hphp/runtime/ext/url/ext_url.cpp
@@ -205,7 +205,7 @@ static void url_encode_array(StringBuffer &ret, const Variant& varr,
const StaticString s_arg_separator_output("arg_separator.output");
Variant HHVM_FUNCTION(http_build_query, const Variant& formdata,
- const Variant& numeric_prefix /* = null_string */,
+ const String& numeric_prefix /* = null_string */,
const String& arg_separator /* = null_string */,
int enc_type /* = k_PHP_QUERY_RFC1738 */) {
if (!formdata.isArray() && !formdata.is(KindOfObject)) {
@@ -222,14 +222,8 @@ Variant HHVM_FUNCTION(http_build_query, const Variant& formdata,
StringBuffer ret(1024);
std::set<void*> seen_arrs;
-
- String num_prefix;
- if (!numeric_prefix.isNull())
- {
- num_prefix = numeric_prefix.toCStrRef();
- }
url_encode_array(ret, formdata, seen_arrs,
- num_prefix, String(), String(), arg_sep,
+ numeric_prefix, String(), String(), arg_sep,
enc_type != k_PHP_QUERY_RFC3986);
return ret.detach();
}
diff --git a/hphp/runtime/ext/url/ext_url.h b/hphp/runtime/ext/url/ext_url.h
index 94ebe56..9339eed 100644
--- a/hphp/runtime/ext/url/ext_url.h
+++ b/hphp/runtime/ext/url/ext_url.h
@@ -43,7 +43,7 @@ Array HHVM_FUNCTION(get_meta_tags, const String& filename,
bool use_include_path /* = false */);
Variant HHVM_FUNCTION(http_build_query, const Variant& formdata,
- const Variant& numeric_prefix /* = null_string */,
+ const String& numeric_prefix /* = null_string */,
const String& arg_separator /* = null_string */,
int enc_type = k_PHP_QUERY_RFC1738);
Variant HHVM_FUNCTION(parse_url, const String& url,
diff --git a/hphp/runtime/ext/url/ext_url.php b/hphp/runtime/ext/url/ext_url.php
index 4c016c4..a858c12 100644
--- a/hphp/runtime/ext/url/ext_url.php
+++ b/hphp/runtime/ext/url/ext_url.php
@@ -81,7 +81,7 @@ function get_meta_tags(string $filename,
<<__Native, __IsFoldable>>
function http_build_query(
mixed $query_data,
- ?string $numeric_prefix = "",
+ string $numeric_prefix = "",
string $arg_separator = "",
int $enc_type = PHP_QUERY_RFC1738): mixed;
diff --git a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php b/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php
deleted file mode 100644
index 43c3473..0000000
--- a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-$query = array(
- 0 => "4.6.1",
- 'php' => "7.0.99-hhvm",
- 'locale' => "de_DE",
- 'mysql' => "5.5.5",
- 'local_package' => "de_DE",
- 'blogs' => 1,
- 'users' => 5,
- 8 => 0,
- 'initial_db_version' => 27916,
-);
-var_dump(http_build_query($query, null, "&"));
-var_dump(http_build_query($query, 52, "&"));
diff --git a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.expect b/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.expect
deleted file mode 100644
index 01cad12..0000000
--- a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-string(113) "0=4.6.1&php=7.0.99-hhvm&locale=de_DE&mysql=5.5.5&local_package=de_DE&blogs=1&users=5&8=0&initial_db_version=27916"
-string(117) "520=4.6.1&php=7.0.99-hhvm&locale=de_DE&mysql=5.5.5&local_package=de_DE&blogs=1&users=5&528=0&initial_db_version=27916"
diff --git a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.opts b/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.opts
deleted file mode 100644
index 7dbaa00..0000000
--- a/hphp/test/slow/ext_url/http_build_query_numeric_prefix.php.opts
+++ /dev/null
@@ -1 +0,0 @@
--dhhvm.php7.all=true
|