PHP 8 Issues
degive opened this issue · 2 comments
degive commented
I am trying to use the class with PHP 8 and ran into 2 issues:
Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in amazon_s3/S3.php on line 2015
$queryString = http_build_query($parameters, null, '&', PHP_QUERY_RFC3986);
Warning: S3Request::__responseWriteCallback(): Argument #1 ($curl) must be passed by reference, value given in amazon_s3/S3.php on line 2414
if (curl_exec($curl))
Can you fix?
Thank you.
Michel
jstanden commented
As best I can tell, you just need:
Index: S3.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/S3.php b/S3.php
--- a/S3.php (revision a65206a2ca36e0da1f136281491e15d28812e0eb)
+++ b/S3.php (date 1662586318214)
@@ -2012,7 +2012,7 @@
// Convert null query string parameters to strings and sort
$parameters = array_map('strval', $parameters);
uksort($parameters, array('self', '__sortMetaHeadersCmp'));
- $queryString = http_build_query($parameters, null, '&', PHP_QUERY_RFC3986);
+ $queryString = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
// Payload
$amzPayload = array($method);
@@ -2452,11 +2452,11 @@
/**
* CURL write callback
*
- * @param resource &$curl CURL resource
- * @param string &$data Data
+ * @param resource $curl CURL resource
+ * @param string $data Data
* @return integer
*/
- private function __responseWriteCallback(&$curl, &$data)
+ private function __responseWriteCallback($curl, $data)
{
if (in_array($this->response->code, array(200, 206)) && $this->fp !== false)
return fwrite($this->fp, $data);
degive commented
That works! Thx