xref: /PHP-7.4/ext/ffi/tests/037.phpt (revision 6738241a)
1--TEST--
2FFI 037: Type memory management
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9function foo($ptr) {
10	$buf = FFI::new("int*[1]");
11	$buf[0] = $ptr;
12	//...
13	return $buf[0];
14}
15
16$int = FFI::new("int");
17$int->cdata = 42;
18var_dump(foo(FFI::addr($int)));
19?>
20--EXPECTF--
21object(FFI\CData:int32_t*)#%d (1) {
22  [0]=>
23  int(42)
24}
25