Skip to content

Commit ce01719

Browse files
authored
Fix PreserveText preg_split with $limit null
Deprecated in PHP 8.1 - preg_split(): Passing null to parameter mraspe#3 ($limit) of type int is deprecated - -1 and 0 had same effect in versions before
1 parent bc8229d commit ce01719

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PhpWord/Element/PreserveText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n
6060
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
6161

6262
$this->text = SharedText::toUTF8($text);
63-
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
63+
$matches = preg_split('/({.*?})/', $this->text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
6464
if (isset($matches[0])) {
6565
$this->text = $matches;
6666
}

0 commit comments

Comments
 (0)