Skip to content

[BUGFIX] Add check if generator is valid before traversing it #4283

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

Conversation

jacobsenj
Copy link
Contributor

@jacobsenj jacobsenj commented Jan 16, 2025

If there's no solr configuration for any site, saving pages or content results in a PHP exception:

Uncaught TYPO3 Exception: Cannot traverse an already closed generator | Exception thrown in file .../Classes/Domain/Site/SiteRepository.php in line 135

The added check prevents this error.

Fixes: #4284

Copy link
Collaborator

@dkd-kaehm dkd-kaehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@jacobsenj jacobsenj force-pushed the jacobsenj-cannot-traverse-an-already-closed-generator branch from da2f122 to b2cbeae Compare January 16, 2025 10:30
@sfroemkenjw
Copy link
Collaborator

All methods in SiteRepository using the result from

$siteGenerator = $this->getAvailableTYPO3ManagedSites($stopOnInvalidSite);

have to test against ->valid()

If this is done, the patch is OK for me.

Stefan

If there's no solr configuration for any site, saving pages or content results in a PHP exception:

Uncaught TYPO3 Exception: Cannot traverse an already closed generator | Exception thrown in file .../Classes/Domain/Site/SiteRepository.php in line 135

The added check prevents this error.
@jacobsenj jacobsenj force-pushed the jacobsenj-cannot-traverse-an-already-closed-generator branch from b2cbeae to 947336b Compare January 22, 2025 11:50
@jacobsenj
Copy link
Contributor Author

I've added the checks for the remaining three calls.

Copy link
Collaborator

@sfroemkenjw sfroemkenjw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me. Thank you for providing that patch.

@andreaswolf
Copy link
Contributor

I also got hit by that bug. Any chance to get this merged and a patchlevel release out soon-ish?

@dkd-kaehm
Copy link
Collaborator

@andreaswolf
Must be ported to release-12.0.x before merging.

dkd-kaehm pushed a commit to dkd-kaehm/ext-solr that referenced this pull request Jan 28, 2025
If there's no solr configuration for any site, saving pages or content results in a PHP exception:

Uncaught TYPO3 Exception: Cannot traverse an already closed generator | Exception thrown in file .../Classes/Domain/Site/SiteRepository.php in line 135

The added check prevents this error.

Fixes: TYPO3-Solr#4284
Ports: TYPO3-Solr#4283
@dkd-kaehm dkd-kaehm merged commit 1e3fe3f into TYPO3-Solr:main Jan 28, 2025
9 checks passed
dkd-kaehm pushed a commit that referenced this pull request Jan 29, 2025
If there's no solr configuration for any site, saving pages or content results in a PHP exception:

Uncaught TYPO3 Exception: Cannot traverse an already closed generator | Exception thrown in file .../Classes/Domain/Site/SiteRepository.php in line 135

The added check prevents this error.

Fixes: #4284
Ports: #4283
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.

[BUG] Cannot traverse an already closed generator
4 participants