PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

php74 MsDoc read .doc file Notice:Trying to access array offset on value of type null

Open easylolicon opened this issue 3 years ago • 4 comments

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

easylolicon avatar Feb 16 '22 10:02 easylolicon

解决了吗?

Jackfinal avatar Jul 12 '22 04:07 Jackfinal

same question

miserabletomato avatar Jul 12 '22 06:07 miserabletomato

Same issue with PHP 7.4.29

lattespirit avatar Aug 05 '22 08:08 lattespirit

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)

kirby-test.zip

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

SchultzenDK avatar Mar 21 '23 14:03 SchultzenDK