From 4584427a358d8bf4aa8c2ce308afadc5f9601ab8 Mon Sep 17 00:00:00 2001 From: Daniel Zahariev Date: Thu, 25 Mar 2021 10:23:36 +0200 Subject: [PATCH] A fix for arrays in request query params #83 --- README.md | 3 +++ src/SimpleEmailService.php | 4 ++-- src/SimpleEmailServiceMessage.php | 2 +- src/SimpleEmailServiceRequest.php | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5bffb91..461faa3 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,9 @@ $ses = new SimpleEmailService('AccessKey', 'SecretKey', $region_endpoint, $trigg ### Changelog +v.0.9.5 +* Fix for arrays in request query params (#83) + v.0.9.4 * Fix for PHP8 errors (#81) diff --git a/src/SimpleEmailService.php b/src/SimpleEmailService.php index 67bccf6..d970081 100644 --- a/src/SimpleEmailService.php +++ b/src/SimpleEmailService.php @@ -46,7 +46,7 @@ * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonSimpleEmailService -* @version v0.9.4 +* @version v0.9.5 */ class SimpleEmailService { @@ -150,7 +150,7 @@ public function __construct($accessKey = null, $secretKey = null, $host = self:: * @deprecated Currently only V4 supported. */ public function setRequestSignatureVersion($requestSignatureVersion) { - $this->__requestSignatureVersion = self::REQUEST_SIGNATURE_V4; + $this->__requestSignatureVersion = $requestSignatureVersion; return $this; } diff --git a/src/SimpleEmailServiceMessage.php b/src/SimpleEmailServiceMessage.php index 29d2a31..ee951f0 100644 --- a/src/SimpleEmailServiceMessage.php +++ b/src/SimpleEmailServiceMessage.php @@ -4,7 +4,7 @@ * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonSimpleEmailService - * @version v0.9.4 + * @version v0.9.5 */ final class SimpleEmailServiceMessage { diff --git a/src/SimpleEmailServiceRequest.php b/src/SimpleEmailServiceRequest.php index fa0d530..12a024c 100644 --- a/src/SimpleEmailServiceRequest.php +++ b/src/SimpleEmailServiceRequest.php @@ -4,7 +4,7 @@ * * @link https://github.com/daniel-zahariev/php-aws-ses * @package AmazonSimpleEmailService -* @version v0.9.4 +* @version v0.9.5 */ class SimpleEmailServiceRequest { @@ -81,6 +81,7 @@ public function setParameter($key, $value, $replace = true) { * Get the params for the request * * @return array $params + * @deprecated */ public function getParametersEncoded() { $params = array(); @@ -146,7 +147,8 @@ protected function getCurlHandler() { public function getResponse() { $url = 'https://'.$this->ses->getHost().'/'; - $query = implode('&', $this->getParametersEncoded()); + ksort($this->parameters); + $query = http_build_query($this->parameters, '', '&', PHP_QUERY_RFC1738); $headers = $this->getHeaders($query); $curl_handler = $this->getCurlHandler(); @@ -271,6 +273,7 @@ private function __responseWriteCallback($curl, $data) { * * @param string $var String to encode * @return string + * @deprecated */ private function __customUrlEncode($var) { return str_replace('%7E', '~', rawurlencode($var));