summaryrefslogtreecommitdiff
path: root/ext/ffi/tests/017.phpt
blob: 718b078bc70482d3590b2e01749df4705320156a (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
--TEST--
FFI 017: Structure constraints & tags cleanup
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
try {
	var_dump(FFI::new("struct X {void x();}"));
} catch (Throwable $e) {
	echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
	var_dump(FFI::new("struct X {struct X x;}"));
} catch (Throwable $e) {
	echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
	var_dump(FFI::new("struct X {struct X *ptr;}"));
} catch (Throwable $e) {
	echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
--EXPECTF--
FFI\ParserException: 'function' type is not allowed at line 1
FFI\ParserException: struct/union can't contain an instance of itself at line 1
object(FFI\CData:struct X)#%d (1) {
  ["ptr"]=>
  NULL
}
ok