mirror of
https://github.com/php/php-src.git
synced 2024-12-04 15:23:44 +08:00
d30cd7d7e7
Closes GH-5590
34 lines
772 B
PHP
34 lines
772 B
PHP
--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
|