summaryrefslogtreecommitdiff
path: root/ext/ffi/tests/035.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi/tests/035.phpt')
-rw-r--r--ext/ffi/tests/035.phpt28
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/ffi/tests/035.phpt b/ext/ffi/tests/035.phpt
new file mode 100644
index 0000000000..fc42f16e88
--- /dev/null
+++ b/ext/ffi/tests/035.phpt
@@ -0,0 +1,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()