@@ -90,6 +90,11 @@ public function __construct(ConfigurationOption $config, string $instanceId, Eve
90
90
$ this ->__parentConstruct ($ config , $ instanceId , $ em );
91
91
}
92
92
93
+ public function __destruct ()
94
+ {
95
+ static ::handleNotifyFork ();
96
+ }
97
+
93
98
94
99
/**
95
100
* @return bool
@@ -164,6 +169,7 @@ public static function prepareToFork(): void
164
169
}
165
170
166
171
if (\version_compare (static ::$ extVersion , '4.2.1 ' , '>= ' )) {
172
+ static ::handleNotifyFork ();
167
173
Cluster::notifyFork (ForkEvent::PREPARE );
168
174
}
169
175
@@ -188,15 +194,20 @@ protected function handleForkedProcess(): void
188
194
$ this ->connect (\posix_getppid ());
189
195
}
190
196
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 );
199
209
}
210
+ static ::$ prepareToForkPPID = 0 ;
200
211
}
201
212
}
202
213
@@ -214,7 +225,7 @@ protected function driverRead(ExtendedCacheItemInterface $item): ?array
214
225
/**
215
226
* CouchbaseBucket::get() returns a GetResult interface
216
227
*/
217
- return $ this ->decodeDocument ((array )$ this ->getCollection ()->get ($ item ->getEncodedKey ())->content ());
228
+ return $ this ->decodeDocument ((array ) $ this ->getCollection ()->get ($ item ->getEncodedKey ())->content ());
218
229
} catch (DocumentNotFoundException ) {
219
230
return null ;
220
231
}
0 commit comments