1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 15:38:49 +02:00
Files
archived-php-src/ext/ffi/tests/037.phpt
T
2020-02-03 22:52:20 +01:00

25 lines
376 B
PHP

--TEST--
FFI 037: Type memory management
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
function foo($ptr) {
$buf = FFI::new("int*[1]");
$buf[0] = $ptr;
//...
return $buf[0];
}
$int = FFI::new("int");
$int->cdata = 42;
var_dump(foo(FFI::addr($int)));
?>
--EXPECTF--
object(FFI\CData:int32_t*)#%d (1) {
[0]=>
int(42)
}