Fix closing failed uv_spawn() (Closes #79)

This commit is contained in:
Bob Weinand 2020-02-15 18:07:24 +01:00
parent 082fdfb203
commit 1682ecf99f
2 changed files with 23 additions and 1 deletions

View File

@ -5122,7 +5122,7 @@ PHP_FUNCTION(uv_spawn)
ret = uv_spawn(&loop->loop, &proc->uv.process, &options);
if (ret) {
PHP_UV_DEINIT_UV(proc);
OBJ_RELEASE(&proc->std);
RETVAL_LONG(ret);
} else {
php_uv_cb_init(&cb, proc, &fci, &fcc, PHP_UV_PROC_CLOSE_CB);

View File

@ -0,0 +1,22 @@
--TEST--
Bad uv_spawn must not segfault (issue #79)
--FILE--
<?php
$rt = uv_spawn(
uv_default_loop(),
'',
array(),
array(),
__DIR__,
array(),
static function () {
echo 'Child Process exited'.PHP_EOL;
}
);
var_dump($rt);
uv_run();
?>
--EXPECTF--
int(-%d)