File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed
Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ PHP_FUNCTION(Async_currentContext)
658658 async_context_t * context = async_context_new ();
659659 context -> scope = scope ;
660660 scope -> context = & context -> base ;
661- RETURN_OBJ (& context -> std );
661+ RETURN_OBJ_COPY (& context -> std );
662662 }
663663
664664 // Return the existing context from scope
Original file line number Diff line number Diff line change @@ -1088,10 +1088,10 @@ static void scope_dispose(zend_async_event_t *scope_event)
10881088 zend_async_scope_remove_child (scope -> scope .parent_scope , & scope -> scope );
10891089 }
10901090
1091- // Clear weak reference from context to scope
10921091 if (scope -> scope .context != NULL ) {
10931092 async_context_t * context = (async_context_t * ) scope -> scope .context ;
10941093 context -> scope = NULL ;
1094+ OBJ_RELEASE (& context -> std );
10951095 }
10961096
10971097 if (scope -> scope .scope_object != NULL ) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Context inheritance through scope hierarchy
55
66use function Async \spawn ;
77use function Async \currentContext ;
8+ use function Async \await ;
89
910echo "start \n" ;
1011
@@ -79,6 +80,8 @@ $child_coroutine = $child_scope->spawn(function() {
7980 return "child_done " ;
8081});
8182
83+ await ($ child_coroutine );
84+
8285$ child_coroutine ->getResult ();
8386
8487echo "end \n" ;
You can’t perform that action at this time.
0 commit comments