File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace Doctrine \Common ;
66
7- use function spl_object_hash ;
7+ use function spl_object_id ;
88
99/**
1010 * The EventManager is the central point of Doctrine's event listener system.
@@ -60,23 +60,23 @@ public function hasListeners(string $event): bool
6060 public function addEventListener (string |array $ events , object $ listener ): void
6161 {
6262 // Picks the hash code related to that listener
63- $ hash = spl_object_hash ($ listener );
63+ $ oid = spl_object_id ($ listener );
6464
6565 foreach ((array ) $ events as $ event ) {
6666 // Overrides listener if a previous one was associated already
6767 // Prevents duplicate listeners on same event (same instance only)
68- $ this ->listeners [$ event ][$ hash ] = $ listener ;
68+ $ this ->listeners [$ event ][$ oid ] = $ listener ;
6969 }
7070 }
7171
7272 /** {@inheritDoc} */
7373 public function removeEventListener (string |array $ events , object $ listener ): void
7474 {
7575 // Picks the hash code related to that listener
76- $ hash = spl_object_hash ($ listener );
76+ $ oid = spl_object_id ($ listener );
7777
7878 foreach ((array ) $ events as $ event ) {
79- unset($ this ->listeners [$ event ][$ hash ]);
79+ unset($ this ->listeners [$ event ][$ oid ]);
8080 }
8181 }
8282
You can’t perform that action at this time.
0 commit comments