File tree Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Fibers in destructors 008: Fibers in shutdown sequence
3
+ --FILE--
4
+ <?php
5
+
6
+ register_shutdown_function (function () {
7
+ printf ("Shutdown \n" );
8
+ });
9
+
10
+ class C {
11
+ public static $ instance ;
12
+ public function __destruct () {
13
+ $ f = new Fiber (function () {
14
+ printf ("Started \n" );
15
+ Fiber::suspend ();
16
+ printf ("Resumed \n" );
17
+ Fiber::suspend ();
18
+ });
19
+ $ f ->start ();
20
+ $ f ->resume ();
21
+ // Can not suspend main fiber
22
+ Fiber::suspend ();
23
+ }
24
+ }
25
+
26
+ C::$ instance = new C ();
27
+
28
+ ?>
29
+ --EXPECTF--
30
+ Shutdown
31
+ Started
32
+ Resumed
33
+
34
+ Fatal error: Uncaught FiberError: Cannot suspend outside of a fiber in %s:%d
35
+ Stack trace:
36
+ #0 %s(%d): Fiber::suspend()
37
+ #1 [internal function]: C->__destruct()
38
+ #2 {main}
39
+ thrown in %s on line %d
Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_sto
44
44
{
45
45
EG (flags ) |= EG_FLAGS_OBJECT_STORE_NO_REUSE ;
46
46
if (objects -> top > 1 ) {
47
- zend_fiber_switch_block ();
48
-
49
47
uint32_t i ;
50
48
for (i = 1 ; i < objects -> top ; i ++ ) {
51
49
zend_object * obj = objects -> object_buckets [i ];
@@ -62,8 +60,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_sto
62
60
}
63
61
}
64
62
}
65
-
66
- zend_fiber_switch_unblock ();
67
63
}
68
64
}
69
65
You can’t perform that action at this time.
0 commit comments