xref: /PHP-7.4/ext/ffi/tests/006.phpt (revision e089d506)
1--TEST--
2FFI 006: Pointer assignment
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$v = FFI::new("int*[2]");
10$v[1] = FFI::new("int[1]", false);
11$v[1][0] = 42;
12var_dump($v);
13FFI::free($v[1]);
14var_dump($v);
15?>
16--EXPECTF--
17object(FFI\CData:int32_t*[2])#%d (2) {
18  [0]=>
19  NULL
20  [1]=>
21  object(FFI\CData:int32_t*)#%d (1) {
22    [0]=>
23    int(42)
24  }
25}
26object(FFI\CData:int32_t*[2])#%d (2) {
27  [0]=>
28  NULL
29  [1]=>
30  NULL
31}
32