Hello,
We have done some tests and the getWordContents method is working correctly. If the error has appeared since a last merge on git, we recommend you check the changes done in the merge. Maybe some problem trying to read the DOCX template? although phpdocx throws an Exception or an error when trying to use a not valid DOCX as template; or an invalid query or empty contents in the main document?
Please run the following sample included in the package: examples/DocxPath/getWordContents/sample_1.php . If you run this sample using the default code or using the following query:
$referenceNode = array(
'type' => 'all',
);
or the following query:
$referenceNode = array(
'type' => '*',
);
the contents are returned correctly. Please run this sample using phpdocx standalone and using the PHP CLI mode to check the output. We have tested it using Windows, Linux and macOS with PHP 5.6, PHP 7.3, PHP 7.4, PHP 8.0, PHP 8.1 and PHP 8.2, and in all cases the output is correct.
If you send a DOCX template sample to contact[at]phpdocx.com we'll run the same code using it to check the output. Also please send the PHP version you are using.
Regards.