Issue #3224421 by ankithashetty, daffie, andypost, longwave, alexpott, xjm: [PHP 8.1] Add a shim to Guzzle 6 for PHP 8.1 compatibility

merge-requests/1220/head
catch 2021-09-21 12:35:31 +01:00
parent c814f744c1
commit 3c4ef6b6bf
3 changed files with 36 additions and 3 deletions

5
composer.lock generated
View File

@ -535,7 +535,7 @@
"dist": {
"type": "path",
"url": "core",
"reference": "833c40df380059ecff9e327223e066ac3a41c328"
"reference": "f3d27c6d13a1d3b6b5e3f2bf2074f63d24c17603"
},
"require": {
"asm89/stack-cors": "^1.1",
@ -765,7 +765,8 @@
"lib/Drupal/Core/Site/Settings.php"
],
"files": [
"includes/bootstrap.inc"
"includes/bootstrap.inc",
"includes/guzzle_php81_shim.php"
]
},
"scripts": {

View File

@ -203,7 +203,8 @@
"lib/Drupal/Core/Site/Settings.php"
],
"files": [
"includes/bootstrap.inc"
"includes/bootstrap.inc",
"includes/guzzle_php81_shim.php"
]
},
"config": {

View File

@ -0,0 +1,31 @@
<?php
// phpcs:ignoreFile
namespace GuzzleHttp;
/**
* Generates URL-encoded query string.
*
* This shim exists to make Guzzle 6 PHP 8.1 compatible.
*
* @link https://php.net/manual/en/function.http-build-query.php
*
* @param object|array $data
* May be an array or object containing properties.
* @param string|null $numeric_prefix
* (optional) If numeric indices are used in the base array and this parameter
* is provided, it will be prepended to the numeric index for elements in
* the base array only.
* @param string|null $arg_separator [optional] <p>
* (optional) arg_separator.output is used to separate arguments, unless this
* parameter is specified, and is then used.
* @param int $encoding_type
* (optional) By default, PHP_QUERY_RFC1738.
*
* @return string
* A URL-encoded string.
*/
function http_build_query($data, $numeric_prefix = '', $arg_separator = '&', $encoding_type = \PHP_QUERY_RFC1738) {
return \http_build_query($data, is_null($numeric_prefix) ? '' : $numeric_prefix, $arg_separator, $encoding_type);
}