Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 Support for addPreserveText #2239

Merged
merged 2 commits into from
Sep 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
PreserveText preg_split fix
third parameter must be -1 not null (php 8.1 deprecate warning)
  • Loading branch information
cscrewsandcaptains committed Jun 8, 2022
commit fc18246b206374ce81d0289c76bba67c6f327ff8
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