Page MenuHomePhabricator

D20049.id47875.diff
No OneTemporary

D20049.id47875.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -528,6 +528,7 @@
'nonempty' => 'utils/utils.php',
'phlog' => 'error/phlog.php',
'pht' => 'internationalization/pht.php',
+ 'phutil_build_http_querystring' => 'utils/utils.php',
'phutil_censor_credentials' => 'utils/utils.php',
'phutil_console_confirm' => 'console/format.php',
'phutil_console_format' => 'console/format.php',
diff --git a/src/future/http/BaseHTTPFuture.php b/src/future/http/BaseHTTPFuture.php
--- a/src/future/http/BaseHTTPFuture.php
+++ b/src/future/http/BaseHTTPFuture.php
@@ -273,7 +273,7 @@
return strlen($data);
}
- return strlen(http_build_query($data, '', '&'));
+ return strlen(phutil_build_http_querystring($data));
}
diff --git a/src/future/http/HTTPFuture.php b/src/future/http/HTTPFuture.php
--- a/src/future/http/HTTPFuture.php
+++ b/src/future/http/HTTPFuture.php
@@ -244,7 +244,7 @@
if ($this->getMethod() == 'GET') {
if (is_array($data)) {
- $data = http_build_query($data, '', '&');
+ $data = phutil_build_http_querystring($data);
if (strpos($uri, '?') !== false) {
$uri .= '&'.$data;
} else {
@@ -254,7 +254,7 @@
}
} else {
if (is_array($data)) {
- $data = http_build_query($data, '', '&')."\r\n";
+ $data = phutil_build_http_querystring($data)."\r\n";
$add_headers[] = array(
'Content-Type',
'application/x-www-form-urlencoded',
diff --git a/src/future/http/HTTPSFuture.php b/src/future/http/HTTPSFuture.php
--- a/src/future/http/HTTPSFuture.php
+++ b/src/future/http/HTTPSFuture.php
@@ -523,7 +523,7 @@
// If we don't have any files, just encode the data as a query string,
// make sure it's not including any files, and we're good to go.
if (is_array($data)) {
- $data = http_build_query($data, '', '&');
+ $data = phutil_build_http_querystring($data);
}
$this->checkForDangerousCURLMagic($data, $is_query_string = true);
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTestInterpreterRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTestInterpreterRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTestInterpreterRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTestInterpreterRule.php
@@ -11,7 +11,7 @@
return sprintf(
"Content: (%s)\nArgv: (%s)",
$content,
- http_build_query($argv));
+ phutil_build_http_querystring($argv));
}
}
diff --git a/src/parser/PhutilURI.php b/src/parser/PhutilURI.php
--- a/src/parser/PhutilURI.php
+++ b/src/parser/PhutilURI.php
@@ -174,7 +174,7 @@
}
if ($this->query) {
- $query = '?'.http_build_query($this->query, '', '&');
+ $query = '?'.phutil_build_http_querystring($this->query, '', '&');
} else {
$query = null;
}
diff --git a/src/utils/utils.php b/src/utils/utils.php
--- a/src/utils/utils.php
+++ b/src/utils/utils.php
@@ -1537,3 +1537,14 @@
return ($bits === 0);
}
+
+
+/**
+ * Build a query string from a dictionary.
+ *
+ * @param map<string, string> Dictionary of parameters.
+ * @return string HTTP query string.
+ */
+function phutil_build_http_querystring(array $parameters) {
+ return http_build_query($parameters, '', '&');
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 10:47 AM (12 h, 27 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6774566
Default Alt Text
D20049.id47875.diff (3 KB)

Event Timeline