8000 [DoctrineBridge] Fix eventListener initialization when eventSubscriber constructor dispatch an event by jderusse · Pull Request #40425 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Fix eventListener initialization when eventSubscriber constructor dispatch an event #40425

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

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

jderusse
Copy link
Member
@jderusse jderusse commented Mar 9, 2021
Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #40365
License MIT
Doc PR -

The issue occurred, when an EventSubscriber (lazyLoaded) dispatch an event when constructed. In that case, the state of the ContainerAwareEventManager become inconsistent for the triggered event:

  • the listener property contains both listener instance and serviceId meaning it's not fully initialized
  • the initialized property contains true meaning the listeners are initialized

Sorry for this PR without test, But it's really to hard to reproduce the issue :(

@parijke @michanismus @fliespl @reypm could you please check if this patch fixes the issue for you?

@carsonbot carsonbot added this to the 4.4 milestone Mar 9, 2021
@jderusse jderusse changed the title Fix eventListener initialization when eventSubscriber constructor dis… Fix eventListener initialization when eventSubscriber constructor dispatch an event Mar 9, 2021
@jderusse jderusse modified the milestone: 4.4 Mar 9, 2021
@carsonbot carsonbot changed the title Fix eventListener initialization when eventSubscriber constructor dispatch an event [DoctrineBridge] Fix eventListener initialization when eventSubscriber constructor dispatch an event Mar 9, 2021
@jderusse jderusse force-pushed the fix-event-subscriber branch from 6564d7a to b3ee292 Compare March 9, 2021 16:20
@reypm
Copy link
reypm commented Mar 9, 2021

@jderusse steps followed:

  • composer update "symfony/*" --with-all-dependencies
  • bin/console clear:cache && bin/console clear:cache --env=test
$ bin/console cache:clear

 // Clearing the cache for the local environment with debug true                                                        
                                                                                                                       
 [OK] Cache for the "local" environment (debug=true) was successfully cleared.                                          
                                                                                                                        
$ bin/console cache:clear --env=test

 // Clearing the cache for the test environment with debug true                                                         
                                                                                                                 
 [OK] Cache for the "test" environment (debug=true) was successfully cleared.                                           

Note: I never get the error while clearing the cache but when running tests

Results with the fix: no more issues

image

@michanismus
Copy link

@jderusse Works!

@fliespl
Copy link
Contributor
fliespl commented Mar 10, 2021

@jderusse I can confirm that it works in our case as well.

@fabpot
Copy link
Member
fabpot commented Mar 10, 2021

Thank you @jderusse.

@fabpot fabpot merged commit a9755c0 into symfony:4.4 Mar 10, 2021
@PierrickMartos
Copy link

Any idea when this will be released to 4.4? Thanks

This was referenced Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0