PHPWord
PHPWord copied to clipboard
php74 MsDoc read .doc file Notice:Trying to access array offset on value of type null
php version 7.4
$word = IOFactory::load('test.doc', 'MsDoc');
Notice: Trying to access array offset on value of type null phpoffice/phpword/src/PhpWord/Reader/MsDoc.php on line 2319 phpoffice/phpword/src/PhpWord/Reader/MsDoc.php on line 2354 phpoffice/phpword/src/PhpWord/Reader/MsDoc.php on line 2346
.... more line
解决了吗?
same question
Same issue with PHP 7.4.29
I have also experienced this issue. I wrote a reproduction document in LibreOffice 7.4.6.2 (x64) (5b1f5509c2decdade7fda905e3e1429a67acd63d)
The zip contains the same document as .odt, .docx, and a .doc (only .doc is throwing the exception)
My code:
$phpWordReader = \PhpOffice\PhpWord\IOFactory::createReader('MsDoc');
if ($phpWordReader->canRead('kirby-test.doc')) {
$phpWord = $phpWordReader->load('kirby-test.doc');
echo 'yup';
} else {
echo 'sorry, nothing';
}
Echoes yup but throws exceptions