Skip to content

Breaking in case of math formulas x #2742

Open
@AwasthiDevanshu

Description

@AwasthiDevanshu

Describe the bug and add attachments

PHP Fatal error: Uncaught PhpOffice\Math\Exception\InvalidInputException: PhpOffice\Math\Reader\OfficeMathML::getElement : The tag m:r has no tag m:t defined in framework/library/vendor/phpoffice/math/src/Math/Reader/OfficeMathML.php:118
Stack trace:
#0 framework/library/vendor/phpoffice/math/src/Math/Reader/OfficeMathML.php(57): PhpOffice\Math\Reader\OfficeMathML->getElement(Object(DOMElement))
#1 framework/library/vendor/phpoffice/math/src/Math/Reader/OfficeMathML.php(42): PhpOffice\Math\Reader\OfficeMathML->parseNode(NULL, Object(PhpOffice\Math\Math))
#2 framework/library/vendor/phpoffice/phpword/src/PhpWord/Reader/Word2007/AbstractPart.php(271): PhpOffice\Math\Reader\OfficeMathML->read('<m:oMath><m:r><...')
#3 framework/library/vendor/phpoffice/phpword/src/PhpWord/Reader/Word2007/Document.php(150): PhpOffice\PhpWord\Reader\Word2007\AbstractPart->readParagraph(Object(PhpOffice\PhpWord\Shared\XMLReader), Object(DOMElement), Object(PhpOffice\PhpWord\Element\Section))
#4 framework/library/vendor/phpoffice/phpword/src/PhpWord/Reader/Word2007/Document.php(57): PhpOffice\PhpWord\Reader\Word2007\Document->readWPNode(Object(PhpOffice\PhpWord\Shared\XMLReader), Object(DOMElement), Object(PhpOffice\PhpWord\Element\Section))
#5 framework/library/vendor/phpoffice/phpword/src/PhpWord/Reader/Word2007.php(115): PhpOffice\PhpWord\Reader\Word2007\Document->read(Object(PhpOffice\PhpWord\PhpWord))

MATHSAPPFOEMET.docx

Expected behavior

it should run and have formulas in math ml and not give error

Steps to reproduce

$objReader = \PhpOffice\PhpWord\IOFactory::createReader('Word2007');
$phpWord = $objReader->load($filePath);

    // Generate the HTML content
    $htmlWriter = new HTML($phpWord);
    $content = $htmlWriter->getContent();

PHPWord version(s) where the bug happened

"name": "phpoffice/phpword", "version": "1.3.0",

PHP version(s) where the bug happened

PHP 8.4.3

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions