Skip to content

Commit

Permalink
Fix PreserveText preg_split with $limit null
Browse files Browse the repository at this point in the history
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
  • Loading branch information
glady authored Oct 13, 2022
1 parent bc8229d commit ce01719
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PhpWord/Element/PreserveText.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ce01719

Please sign in to comment.