From a8c1f386aad2938be7afa1c9d626e6ae186201c2 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 13 May 2022 17:09:58 +0300 Subject: [PATCH] Fix item description with emoji --- modules/ppcp-api-client/src/Factory/ItemFactory.php | 2 +- tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ppcp-api-client/src/Factory/ItemFactory.php b/modules/ppcp-api-client/src/Factory/ItemFactory.php index fe1335476..ea639e704 100644 --- a/modules/ppcp-api-client/src/Factory/ItemFactory.php +++ b/modules/ppcp-api-client/src/Factory/ItemFactory.php @@ -142,7 +142,7 @@ class ItemFactory { mb_substr( $product->get_name(), 0, 127 ), new Money( $price_without_tax_rounded, $currency ), $quantity, - mb_substr( wp_strip_all_tags( $product->get_description() ), 0, 127 ), + substr( wp_strip_all_tags( $product->get_description() ), 0, 127 ) ?: '', $tax, $product->get_sku(), ( $product->is_virtual() ) ? Item::DIGITAL_GOODS : Item::PHYSICAL_GOODS diff --git a/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php b/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php index ee89d6f5c..0decea0f8 100644 --- a/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php +++ b/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php @@ -300,7 +300,7 @@ class ItemFactoryTest extends TestCase * @var Item $item */ $this->assertEquals(mb_substr($name, 0, 127), $item->name()); - $this->assertEquals(mb_substr($description, 0, 127), $item->description()); + $this->assertEquals(substr($description, 0, 127), $item->description()); } public function testFromPayPalResponse()