xref: /PHP-8.4/ext/ffi/tests/addr_to_owned.phpt (revision d4ad9b72)
1--TEST--
2FFI Referencing temporary owned data transfers ownership
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$ffi = \FFI::cdef(<<<'CPP'
10typedef struct {
11    int8_t bar;
12} Foo;
13CPP);
14$structPtr = \FFI::addr($ffi->new('Foo'));
15var_dump($structPtr);
16?>
17--EXPECT--
18object(FFI\CData:struct <anonymous>*)#3 (1) {
19  [0]=>
20  object(FFI\CData:struct <anonymous>)#2 (1) {
21    ["bar"]=>
22    int(0)
23  }
24}
25