2017-05-16 18:17:12 +02:00
|
|
|
--TEST--
|
|
|
|
Test order of destruction not interfering with access to UV handles
|
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
2017-11-29 13:36:50 +01:00
|
|
|
\extension_loaded("uv") or die("SKIP: ext/uv required for this test");
|
2017-05-16 18:17:12 +02:00
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
include __DIR__.'/../../vendor/autoload.php';
|
|
|
|
|
2020-10-03 15:38:31 +02:00
|
|
|
use Amp\Loop\UvDriver;
|
2017-05-16 18:17:12 +02:00
|
|
|
|
2020-10-03 15:38:31 +02:00
|
|
|
$loop = new UvDriver;
|
|
|
|
|
|
|
|
$loop->setState('test', new class($loop) {
|
|
|
|
private UvDriver $loop;
|
|
|
|
private string $handle;
|
|
|
|
public function __construct(UvDriver $loop)
|
|
|
|
{
|
|
|
|
$this->loop = $loop;
|
|
|
|
$this->handle = $this->loop->repeat(10, function () {});
|
|
|
|
}
|
|
|
|
public function __destruct()
|
|
|
|
{
|
|
|
|
$this->loop->cancel($this->handle);
|
|
|
|
print "ok";
|
|
|
|
}
|
2017-05-16 18:17:12 +02:00
|
|
|
});
|
|
|
|
|
2020-10-03 15:38:31 +02:00
|
|
|
$loop->delay(0, [$loop, "stop"]);
|
|
|
|
|
|
|
|
$loop->run();
|
|
|
|
|
2017-05-16 18:17:12 +02:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
ok
|