Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader ERROR -> libxml_disable_entity_loader() is deprecated in PHP8 #2577

Open
Wolclaws opened this issue Feb 29, 2024 · 0 comments
Open

Reader ERROR -> libxml_disable_entity_loader() is deprecated in PHP8 #2577

Wolclaws opened this issue Feb 29, 2024 · 0 comments

Comments

@Wolclaws
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant