From 60b35414bd3fb4ec7a05f3a93c45a3e989351d71 Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Thu, 2 Feb 2023 13:49:25 +0800 Subject: [PATCH 1/4] Allow null on setters for description and sku on lineitems --- src/models/LineItem.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/models/LineItem.php b/src/models/LineItem.php index c04884f829..fd7581abad 100644 --- a/src/models/LineItem.php +++ b/src/models/LineItem.php @@ -316,14 +316,17 @@ public function getDescription(): string } /** - * @param string $description + * @param ?string $description * @return void */ - public function setDescription(string $description): void + public function setDescription(?string $description): void { - $this->_description = $description; + $this->_description = (string)$description; } + /** + * @return string + */ public function getSku(): string { if (!$this->_sku) { @@ -334,9 +337,13 @@ public function getSku(): string return $this->_sku; } - public function setSku(string $sku): void + /** + * @param ?string $sku + * @return void + */ + public function setSku(?string $sku): void { - $this->_sku = $sku; + $this->_sku = (string)$sku; } /** From 62953a4dce09e44f055e836f0a58863d5f24acd6 Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Thu, 2 Feb 2023 13:58:47 +0800 Subject: [PATCH 2/4] Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bdd971532..7df345dd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft Commerce +## Unreleased + +- Fixed a PHP that occurred when retrieving orders with missing line item descriptions or SKUs. ([#2936](https://github.com/craftcms/commerce/issues/2936)) + ## 4.2.5 - 2023-02-01 - Added support for searching for orders by customer name. ([#3050](https://github.com/craftcms/commerce/issues/3050)) From b0aed87d2546d5245512d3792a49ca287a930d7b Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Thu, 2 Feb 2023 21:55:27 +0800 Subject: [PATCH 3/4] Fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df345dd8b..c2bc12c955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- Fixed a PHP that occurred when retrieving orders with missing line item descriptions or SKUs. ([#2936](https://github.com/craftcms/commerce/issues/2936)) +- Fixed a PHP error that occurred when retrieving orders with missing line item descriptions or SKUs. ([#2936](https://github.com/craftcms/commerce/issues/2936)) ## 4.2.5 - 2023-02-01 From 68fb3fcc5447a9fac1a44ee8536e876f38e99d8e Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Thu, 2 Feb 2023 21:57:14 +0800 Subject: [PATCH 4/4] Finished 4.2.5.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2bc12c955..c9227a8ba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Craft Commerce -## Unreleased +## 4.2.5.1 - 2023-02-02 - Fixed a PHP error that occurred when retrieving orders with missing line item descriptions or SKUs. ([#2936](https://github.com/craftcms/commerce/issues/2936))