xref: /PHP-8.0/ext/ffi/tests/023.phpt (revision 54ecf57f)
1--TEST--
2FFI 023: GCC struct extensions
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
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