From 2bba013311bdb3e728d3facc807b77e02561d894 Mon Sep 17 00:00:00 2001 From: Michael Als Date: Tue, 29 Mar 2022 13:13:45 +0000 Subject: [PATCH 1/2] PHP 8.1 compatability fix for PreserveText --- 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 c0e64268..803ee4f3 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -60,7 +60,7 @@ class PreserveText extends AbstractElement $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; } From 6b331603e6a56781e04fb5c35a1b0aadcf58fe52 Mon Sep 17 00:00:00 2001 From: Michael Als Date: Wed, 30 Mar 2022 12:42:45 +0000 Subject: [PATCH 2/2] Added return type will change to XMLWriter.php --- src/PhpWord/Shared/XMLWriter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpWord/Shared/XMLWriter.php b/src/PhpWord/Shared/XMLWriter.php index 930ad62e..882492e0 100644 --- a/src/PhpWord/Shared/XMLWriter.php +++ b/src/PhpWord/Shared/XMLWriter.php @@ -171,6 +171,7 @@ class XMLWriter extends \XMLWriter * @param mixed $value * @return bool */ + #[\ReturnTypeWillChange] public function writeAttribute($name, $value) { if (is_float($value)) {