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