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

internal error: Huge input lookup #148

Open
tvaughan73 opened this issue May 5, 2023 · 6 comments · May be fixed by #150
Open

internal error: Huge input lookup #148

tvaughan73 opened this issue May 5, 2023 · 6 comments · May be fixed by #150

Comments

@tvaughan73
Copy link

When reading a large excel file I am getting the warnings/error below. Any idea what would cause this?

Severity: Warning --> XMLReader::expand(): zip:///home/dev/tmp/usertemp645567ee73f18/2023.04_US_Tax_Summary_Extract_05.02.2023.xlsx#xl/worksheets/sheet1.xml:2: parser error : internal error: Huge input lookup /vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php 322
Severity: Warning --> XMLReader::expand(): 0494</v></c><c r="G23314" t="s"><v>7313</v></c><c r="H23314" t="s"><v>56</v></c> /vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php 322
Severity: Warning --> XMLReader::expand():                                                                                ^ /vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php 322
Severity: Warning --> XMLReader::expand(): An Error Occurred while expanding /vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php 322
Severity: error --> Exception: OpenSpout\Reader\XLSX\RowIterator::getCell(): Argument #1 ($node) must be of type DOMElement, bool given, called in /vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php on line 323 /home/dev/public_html/application/vendor/openspout/openspout/src/Reader/XLSX/RowIterator.php 404
@Slamdunk
Copy link
Contributor

Slamdunk commented May 8, 2023

Any idea what would cause this?

Nope

@Tikvout
Copy link

Tikvout commented May 9, 2023

Hi,
I recently got this same error this morning and managed to fix it.
I'm not 100% what the cause is but it seems to be related to memory caused by input buffering.

My fix was to update the openFileInZip method.
In "src/Reader/Wrapper/XMLReader.php"

Changed:

$wasOpenSuccessful = $this->open($realPathURI, null, LIBXML_NONET);

To:

$wasOpenSuccessful = $this->open($realPathURI, null, LIBXML_COMPACT | LIBXML_PARSEHUGE);

By adding the 2 flags LIBXML_COMPACT and LIBXML_PARSEHUGE.
See PHP documentation here for a better understanding on what each flag does.
https://www.php.net/manual/en/libxml.constants.php

I hope this helps.

@tvaughan73
Copy link
Author

tvaughan73 commented May 9, 2023

@Tikvout Thank You!!! this worked. @Slamdunk would this be a change you would consider? As a side note, making this change increased the speed dramatically.

@Slamdunk
Copy link
Contributor

Slamdunk commented May 9, 2023

Would you like to propose a PR with such change?

My only note is to keep LIBXML_NONET flag please.

@Slamdunk Slamdunk linked a pull request May 9, 2023 that will close this issue
@tvaughan73
Copy link
Author

Yes, just put in a PR for the change. Thanks!

@Slamdunk
Copy link
Contributor

@Tikvout have a look at #150 (comment)

@Slamdunk Slamdunk reopened this May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants