summaryrefslogtreecommitdiff
path: root/ext/ffi/tests/033.phpt
blob: 01816d18b13a6a69ee1d16b43391cf85811d35ec (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--TEST--
FFI 033: FFI::new(), FFI::free(), FFI::type(), FFI::typeof(), FFI::arrayType()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
$p1 = FFI::new("uint8_t[2]");
$p2 = FFI::new("uint16_t[2]", true, true);
var_dump($p1, $p2);

$t1 = FFI::typeof($p1);
var_dump($t1);

$p4 = FFI::new($t1);
var_dump($p4);

$t2 = FFI::type("uint16_t[2]");
var_dump($t2);
$p4 = FFI::new($t2);
var_dump($p4);

$t2 = FFI::type("uint32_t");
var_dump($t2);
$t3 = FFI::arrayType($t2, [2, 2]);
var_dump($t3);
?>
--EXPECTF--
object(FFI\CData:uint8_t[2])#%d (2) {
  [0]=>
  int(0)
  [1]=>
  int(0)
}
object(FFI\CData:uint16_t[2])#%d (2) {
  [0]=>
  int(0)
  [1]=>
  int(0)
}
object(FFI\CType:uint8_t[2])#%d (0) {
}
object(FFI\CData:uint8_t[2])#%d (2) {
  [0]=>
  int(0)
  [1]=>
  int(0)
}
object(FFI\CType:uint16_t[2])#%d (0) {
}
object(FFI\CData:uint16_t[2])#%d (2) {
  [0]=>
  int(0)
  [1]=>
  int(0)
}
object(FFI\CType:uint32_t)#%d (0) {
}
object(FFI\CType:uint32_t[2][2])#%d (0) {
}