summaryrefslogtreecommitdiff
path: root/ext/ffi/tests/023.phpt
blob: 651713bf2bca7c6365f6fe259c3c4b5e47b3fb49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--TEST--
FFI 023: GCC struct extensions
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
    try {
        var_dump(FFI::sizeof(FFI::new("struct {}")));
    } catch (Throwable $e) {
        echo get_class($e) . ": " . $e->getMessage() . "\n";
    }
    var_dump(FFI::sizeof(FFI::new("struct {int a}")));
    var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
?>
ok
--EXPECT--
FFI\Exception: Cannot instantiate FFI\CData of zero size
int(4)
int(8)
ok