xref: /php-src/Zend/tests/fibers/gh10496-001.phpt (revision 95016138)
1--TEST--
2Bug GH-10496 001 (Segfault when garbage collector is invoked inside of fiber)
3--FILE--
4<?php
5
6function x(&$ref) {
7	$ref = new class() {
8		function __destruct() {
9			print "Dtor x()\n";
10		}
11	};
12}
13function suspend($x) {
14	Fiber::suspend();
15}
16$f = new Fiber(function() use (&$f) {
17	try {
18		x($var);
19		\ord(suspend(1));
20	} finally {
21		print "Cleaned\n";
22	}
23});
24$f->start();
25unset($f);
26gc_collect_cycles();
27print "Collected\n";
28
29?>
30--EXPECT--
31Cleaned
32Dtor x()
33Collected
34