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 · 1 comment
Open
Labels
Bug Report Open XML (Word 2007+) Status: Waiting for feedback Question has been asked, waiting for response from PR author

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
@Progi1984
Copy link
Member

Sorry but PHPWord & PHPSpreadsheet doesn't use PHPOffice/Common.

Do you use PHPPresentation ?

@Progi1984 Progi1984 added the Status: Waiting for feedback Question has been asked, waiting for response from PR author label Aug 12, 2024
@Progi1984 Progi1984 removed this from the 2.0.0 milestone Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Open XML (Word 2007+) Status: Waiting for feedback Question has been asked, waiting for response from PR author
Development

No branches or pull requests

2 participants