Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Conversation

weierophinney
Copy link
Member

In testing zend-eventmanager, I discovered a race condition with the following:

while ($queue->contains($listener)) {
    $queue->remove($listener);
}

In debugging, I determined that while remove() was correctly identifying that it had the datum, it was not using the correct index in the value array to unset it, which would leave it in place. Modifying the code to use key() on the values array allows it to work as expected.

In testing zend-eventmanager, I discovered a race condition with the
following:

```php
while ($queue->contains($listener)) {
    $queue->remove($listener);
}
```

In debugging, I determined that while `remove()` was correctly
identifying that it had the datum, it was not using the correct index in
the value array to unset it, which would leave it in place. Modifying
the code to use `key()` on the values array allows it to work as
expected.
@weierophinney weierophinney added this to the 2.7.3 milestone Sep 25, 2015
@weierophinney weierophinney self-assigned this Sep 25, 2015
@weierophinney weierophinney merged commit 21375e8 into zendframework:master Sep 25, 2015
weierophinney added a commit that referenced this pull request Sep 25, 2015
@weierophinney weierophinney deleted the hotfix/remove-with-multiple-items-in-queue branch September 25, 2015 04:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant