php-src/ext/ffi/tests/035.phpt
2019-01-14 11:47:50 +03:00

29 lines
453 B
PHP

--TEST--
FFI 035: FFI::new() not-owned
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
$p = FFI::new("uint16_t[2]", false);
var_dump($p);
FFI::free($p);
try {
var_dump($p);
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECTF--
object(FFI\CData:uint16_t[2])#%d (2) {
[0]=>
int(0)
[1]=>
int(0)
}
object(FFI\CData:uint16_t[2])#%d (0) {
}
FFI\Exception: Use after free()