-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy path013.phpt
68 lines (65 loc) · 1.61 KB
/
013.phpt
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
62
63
64
65
66
67
68
--TEST--
FFI 013: Declaration priorities and constrains
--EXTENSIONS--
ffi
--INI--
ffi.enable=1
--FILE--
<?php
$ffi = FFI::cdef();
$a = $ffi->new("int[1][2][3]");
var_dump(count($a));
var_dump(count($a[0]));
var_dump(count($a[0][0]));
try {
var_dump($ffi->new("void"));
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
var_dump($ffi->new("void[1]"));
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("static int foo(int)[5];");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("static int foo[5](int);");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("static int foo(int)(int);");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("typedef int foo[2][];");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("typedef int foo[][2];");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
int(1)
int(2)
int(3)
FFI\ParserException: void type is not allowed at line 1
FFI\ParserException: void type is not allowed at line 1
FFI\ParserException: Function returning array is not allowed at line 1
FFI\ParserException: Array of functions is not allowed at line 1
FFI\ParserException: Function returning function is not allowed at line 1
FFI\ParserException: Only the leftmost array can be undimensioned at line 1
ok