xref: /PHP-8.1/ext/ffi/tests/018.phpt (revision bd9f4fa6)
1--TEST--
2FFI 018: Indirectly recursive structure
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9try {
10    FFI::cdef("struct X {struct X x[2];};");
11    echo "ok\n";
12} catch (Throwable $e) {
13    echo get_class($e) . ": " . $e->getMessage()."\n";
14}
15try {
16    FFI::cdef("struct X {struct X *ptr[2];};");
17    echo "ok\n";
18} catch (Throwable $e) {
19    echo get_class($e) . ": " . $e->getMessage()."\n";
20}
21?>
22ok
23--EXPECT--
24FFI\ParserException: Incomplete struct "X" at line 1
25ok
26ok
27