@@ -302,7 +302,7 @@ protected function readParagraph(XMLReader $xmlReader, DOMElement $domNode, $par
302302 $ nodes = $ xmlReader ->getElements ('w:r|w:hyperlink ' , $ domNode );
303303 $ hasRubyElement = $ xmlReader ->elementExists ('w:r/w:ruby ' , $ domNode );
304304 if ($ nodes ->length === 1 && !$ hasRubyElement ) {
305- $ textContent = htmlspecialchars ($ xmlReader ->getValue ('w:t ' , $ nodes ->item (0 )), ENT_QUOTES , 'UTF-8 ' );
305+ $ textContent = htmlspecialchars ($ xmlReader ->getValue ('w:t ' , $ nodes ->item (0 )) ?? '' , ENT_QUOTES , 'UTF-8 ' );
306306 } else {
307307 $ textContent = new TextRun ($ paragraphStyle );
308308 foreach ($ nodes as $ node ) {
@@ -559,14 +559,14 @@ protected function readRunChild(XMLReader $xmlReader, DOMElement $node, Abstract
559559 if ($ fallbackElements ->length ) {
560560 $ fallback = $ fallbackElements ->item (0 );
561561 // TextRun
562- $ textContent = htmlspecialchars ($ fallback ->nodeValue , ENT_QUOTES , 'UTF-8 ' );
562+ $ textContent = htmlspecialchars ($ fallback ->nodeValue ?? '' , ENT_QUOTES , 'UTF-8 ' );
563563
564564 $ parent ->addText ($ textContent , $ fontStyle , $ paragraphStyle );
565565 }
566566 }
567567 } elseif ($ node ->nodeName == 'w:t ' || $ node ->nodeName == 'w:delText ' ) {
568568 // TextRun
569- $ textContent = htmlspecialchars ($ xmlReader ->getValue ('. ' , $ node ), ENT_QUOTES , 'UTF-8 ' );
569+ $ textContent = htmlspecialchars ($ xmlReader ->getValue ('. ' , $ node ) ?? '' , ENT_QUOTES , 'UTF-8 ' );
570570
571571 if ($ runParent ->nodeName == 'w:hyperlink ' ) {
572572 $ rId = $ xmlReader ->getAttribute ('r:id ' , $ runParent );
0 commit comments