summaryrefslogtreecommitdiff
path: root/ext/ffi/tests/035.phpt
blob: fc42f16e888a579b2971426aab4cba817e4b9138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--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()