Forum


Replies: 2   Views: 2172
Bug with transformsizes and non-numeric values
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by helpdesk@hrdownloads.com  · 14-02-2019 - 21:00

I'm getting a critical error converting a docx document. The error appears to be related to the transformSizes function and occurs in the main transform function when processing the document xml. Other docx files process normally.

I dug into the XML code and found a number of elements that were set to "nil". I'm not certain that this is the source of the issue but I can see this causing potential problems if nil isn't converting to zero.

<w:top w:val="nil"/>

[2019-02-14 19:52:32] development.ERROR: A non-numeric value encountered {"exception":"[object] (ErrorException(code: 0): A non-numeric value encountered at /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTMLDefaultPlugin.php:126)
[stacktrace]
#0 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTMLDefaultPlugin.php(126): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'A non-numeric v...', '/home/local.user...', 126, Array)
#1 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(832): Phpdocx\\Transform\\TransformDocAdvHTMLDefaultPlugin->transformSizes('', 'eights')
#2 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(2575): Phpdocx\\Transform\\TransformDocAdvHTML->getCellStyles(Object(DOMElement))
#3 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(362): Phpdocx\\Transform\\TransformDocAdvHTML->transformW_TBL(Object(DOMElement), 'docx_5c65c70079...')
#4 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(1298): Phpdocx\\Transform\\TransformDocAdvHTML->transformXml(Object(DOMElement))
#5 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(421): Phpdocx\\Transform\\TransformDocAdvHTML->transformDEFAULT_TAG(Object(DOMElement), 'docx_5c65c6ff18...')
#6 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(1298): Phpdocx\\Transform\\TransformDocAdvHTML->transformXml(Object(DOMElement))
#7 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(421): Phpdocx\\Transform\\TransformDocAdvHTML->transformDEFAULT_TAG(Object(DOMElement), 'docx_5c65c6ff18...')
#8 /home/local.user/project/vendor/project/phpdocx/Classes/Phpdocx/Transform/TransformDocAdvHTML.php(260): Phpdocx\\Transform\\TransformDocAdvHTML->transformXml(Object(DOMDocument))
#9 /home/local.user/project/Modules/Core/Services/DocConversionService.php(82): Phpdocx\\Transform\\TransformDocAdvHTML->transform(Object(Phpdocx\\Transform\\TransformDocAdvHTMLDefaultPlugin))