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

Replaced Box/Spout by OpenSpout (fix #206). #207

Merged
merged 1 commit into from
Feb 11, 2023

Conversation

Daniel-KM
Copy link
Contributor

No description provided.

@zerocrates
Copy link
Contributor

Have you tried this out?

I'm getting

OpenSpout\Reader\ODS\RowIterator::current(): Return value must be of type OpenSpout\Common\Entity\Row, null returned

... it looks like a bug that happens when calling current() right when starting the iterator... When they introduced typehinting on their returns, they no longer allow current() to return null, which it will do before any calls to next() or rewind().

What it wants to happen is a single call to rewind before using current (as PHP does when it starts foreach-ing an iterator). Unfortunately If we just rewind() right when we load the iterator, then any later foreach we do will hit an error because Spout/Openspout's iterator only allows a single rewind.

You already did some workaround-ing of this in the current code: getRows uses the direct iterator calls rather than foreach, and just does an extra next call at the beginning to skip past the initial null return but not have to call rewind.

Probably there's ultimately a solution where we just call our reset and get a fresh Iterator again even more than we already do, and then we can just use foreach everywhere.

@zerocrates zerocrates merged commit cbae922 into omeka-s-modules:develop Feb 11, 2023
@zerocrates
Copy link
Contributor

I've made changes to account for this problem (which also revealed a minor latent problem with the existing code for the ODS source).

@Daniel-KM Daniel-KM deleted the fix/openspout branch February 14, 2023 16:17
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 this pull request may close these issues.

2 participants