@@ -90,6 +90,11 @@ public function __construct(ConfigurationOption $config, string $instanceId, Eve
9090 $ this ->__parentConstruct ($ config , $ instanceId , $ em );
9191 }
9292
93+ public function __destruct ()
94+ {
95+ static ::handleNotifyFork ();
96+ }
97+
9398
9499 /**
95100 * @return bool
@@ -164,6 +169,7 @@ public static function prepareToFork(): void
164169 }
165170
166171 if (\version_compare (static ::$ extVersion , '4.2.1 ' , '>= ' )) {
172+ static ::handleNotifyFork ();
167173 Cluster::notifyFork (ForkEvent::PREPARE );
168174 }
169175
@@ -188,15 +194,20 @@ protected function handleForkedProcess(): void
188194 $ this ->connect (\posix_getppid ());
189195 }
190196
191- if (\version_compare (static ::$ extVersion , '4.2.1 ' , '>= ' )) {
192- if (static ::$ prepareToForkPPID === \posix_getpid ()) {
193- Cluster::notifyFork (ForkEvent::PARENT );
194- } else {
195- Cluster::notifyFork (ForkEvent::CHILD );
196- }
197- static ::$ prepareToForkPPID = 0 ;
198- }
197+ static ::handleNotifyFork ();
198+ }
199+ }
200+ }
201+
202+ protected static function handleNotifyFork (): void
203+ {
204+ if (static ::$ prepareToForkPPID && \version_compare (static ::$ extVersion , '4.2.1 ' , '>= ' )) {
205+ if (static ::$ prepareToForkPPID === \posix_getpid ()) {
206+ Cluster::notifyFork (ForkEvent::PARENT );
207+ } else {
208+ Cluster::notifyFork (ForkEvent::CHILD );
199209 }
210+ static ::$ prepareToForkPPID = 0 ;
200211 }
201212 }
202213
@@ -214,7 +225,7 @@ protected function driverRead(ExtendedCacheItemInterface $item): ?array
214225 /**
215226 * CouchbaseBucket::get() returns a GetResult interface
216227 */
217- return $ this ->decodeDocument ((array )$ this ->getCollection ()->get ($ item ->getEncodedKey ())->content ());
228+ return $ this ->decodeDocument ((array ) $ this ->getCollection ()->get ($ item ->getEncodedKey ())->content ());
218229 } catch (DocumentNotFoundException ) {
219230 return null ;
220231 }
0 commit comments