Skip to content

IBX-11276: Adjusted iterator_to_array usage for SendersLocator#7

Closed
Steveb-p wants to merge 3 commits into4.6from
fix-sender-not-found
Closed

IBX-11276: Adjusted iterator_to_array usage for SendersLocator#7
Steveb-p wants to merge 3 commits into4.6from
fix-sender-not-found

Conversation

@Steveb-p
Copy link
Contributor

@Steveb-p Steveb-p commented Feb 4, 2026

🎫 Issue IBX-11276

Description:

Under certain circumstances Ibexa Messenger will fail to send a message to queue for background processing.

This is due to the fact that Ibexa\Bundle\Messenger\Transport\MessageProviderRegistry::getHandledClasses() return from internal Generators, which share keys (in yield from).

This causes specific classes to be excluded from queueing.

For QA:

Documentation:

@Steveb-p Steveb-p changed the base branch from main to 4.6 February 4, 2026 11:45
@Steveb-p Steveb-p requested review from a team and Copilot February 4, 2026 11:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a bug where Ibexa Messenger fails to send messages to queue for background processing due to duplicate keys when using iterator_to_array on generators with yield from statements.

Changes:

  • Modified iterator_to_array call to disable key preservation, preventing duplicate keys from causing classes to be excluded
  • Added test coverage for multiple generator scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/bundle/Transport/Sender/SendersLocator.php Fixed iterator_to_array to use false for preserve_keys parameter to handle generators with duplicate keys
tests/bundle/Transport/Sender/SendersLocatorTest.php Added test case verifying correct behavior when multiple generators are used

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +115 to +116
yield from ['stdClass'];
yield from ['AnotherClass'];
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The test uses yield from on arrays which doesn't reproduce the duplicate key issue described in the PR. When using yield from on arrays with numeric keys (like ['stdClass']), both arrays have key 0, which would be overwritten. The test should use explicit keys or demonstrate the actual duplicate key scenario to properly validate the fix. Consider: yield 'key1' => 'stdClass'; yield 'key1' => 'AnotherClass'; or using generators that produce duplicate keys.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's exactly what it does, it produces duplicate keys.

Nice catch Copilot.

@Steveb-p Steveb-p closed this Feb 4, 2026
@Steveb-p Steveb-p deleted the fix-sender-not-found branch February 4, 2026 11:58
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