xref: /PHP-8.1/ext/ffi/tests/023.phpt (revision bd9f4fa6)
1--TEST--
2FFI 023: GCC struct extensions
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9    try {
10        var_dump(FFI::sizeof(FFI::new("struct {}")));
11    } catch (Throwable $e) {
12        echo get_class($e) . ": " . $e->getMessage() . "\n";
13    }
14    var_dump(FFI::sizeof(FFI::new("struct {int a}")));
15    var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
16?>
17ok
18--EXPECT--
19FFI\Exception: Cannot instantiate FFI\CData of zero size
20int(4)
21int(8)
22ok
23