From e6c1d2c2d38e553bb0ec41712dc71f58a0c1804a Mon Sep 17 00:00:00 2001 From: GHaddonAD Date: Tue, 17 Oct 2023 16:10:11 +0100 Subject: [PATCH] Fix passing null to parameter error, and avoids array to string conversion error if data is an array. --- Model/Order.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Model/Order.php b/Model/Order.php index 5ba5de8..9935ad6 100644 --- a/Model/Order.php +++ b/Model/Order.php @@ -201,11 +201,14 @@ public function escapeJsQuote($data, $quote = '\'') /** * @param $data - * @return string + * @return array|string|null */ public function escapeReturn($data) { - return trim(str_replace(["\r\n", "\r", "\n"], ' ', $data)); + if (!is_null($data) && !is_array($data)) { + return trim(str_replace(["\r\n", "\r", "\n"], ' ', $data)); + } + return $data; } /**