diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bdd971532..c9227a8ba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft Commerce +## 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)) + ## 4.2.5 - 2023-02-01 - Added support for searching for orders by customer name. ([#3050](https://github.com/craftcms/commerce/issues/3050)) 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; } /**