From ce01719cd3298e3b92cc8ffce8193a0cc2f9d2f6 Mon Sep 17 00:00:00 2001 From: Mike Gladysch Date: Thu, 13 Oct 2022 08:13:43 +0200 Subject: [PATCH] Fix PreserveText preg_split with $limit null Deprecated in PHP 8.1 - preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated - -1 and 0 had same effect in versions before --- src/PhpWord/Element/PreserveText.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index c0e64268ba..803ee4f395 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -60,7 +60,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n $this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); $this->text = SharedText::toUTF8($text); - $matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $matches = preg_split('/({.*?})/', $this->text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if (isset($matches[0])) { $this->text = $matches; }