Open
Description
Deprecated function with reader
With the code below I would only like to recover the contents of the word file but the following error appears. I use php 8.3.
How can I solve the problem?
Deprecated: Function libxml_disable_entity_loader() is deprecated in /web/htdocs/.../vendor/phpoffice/common/src/Common/XMLReader.php on line 74
Deprecated: ZipArchive::open(): Passing null to parameter #2 ($flags) of type int is deprecated in /web/htdocs/.../vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php on line 136
This is my simple code
Please provide a code sample that reproduces the issue.
...
$objReader = \PhpOffice\PhpWord\IOFactory::createReader('Word2007');
$phpWord = $objReader->load($file);
$text = '';
foreach ($phpWord->getSections() as $section) {
foreach ($section->getElements() as $element) {
if ($element instanceof \PhpOffice\PhpWord\Element\Text) {
$text .= $element->getText();
}
}
}
echo $text;
...
The file Word
It's a simple docx with written "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
Context
On the same site I also use PHPSpreadsheet
- PHP Version: 8.3
- PHPWord Version: 1.2
- PHPSpreadsheet Version: 1.15