Skip to content

Commit 79f65f0

Browse files
committed
Fixed bug with footer preserve text
1 parent a6671c2 commit 79f65f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Classes/PHPWord/Section/Footer/PreserveText.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ public function __construct($text = null, $styleFont = null, $styleParagraph = n
8989
$this->_styleParagraph = $styleParagraph;
9090
}
9191

92-
$pattern = '/({.*?})/';
93-
$this->_text = preg_split($pattern, $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
92+
$matches = preg_split('/({.*?})/', $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
93+
if (isset($matches[0])) {
94+
$this->_text = $matches[0];
95+
}
9496

9597
return $this;
9698
}

0 commit comments

Comments
 (0)