xref: /PHP-8.3/ext/ffi/tests/gh14286_1.phpt (revision c0de7214)
1--TEST--
2GH-14286 (ffi enum type (when enum has no name) make memory leak)
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$ffi = FFI::cdef("
10    enum {
11        TEST_ONE=1,
12        TEST_TWO=2,
13    };
14    enum TestEnum {
15        TEST_THREE=3,
16    };
17    struct TestStruct {
18        enum {
19            TEST_FOUR=4,
20        } test1;
21        enum TestEnum2 {
22            TEST_FIVE=5,
23        } test2;
24    };
25    typedef enum { TEST_SIX=6 } TestEnum3;
26    struct {
27        int x;
28    };
29    union {
30        int x;
31    };
32");
33var_dump($ffi->TEST_ONE);
34var_dump($ffi->TEST_TWO);
35var_dump($ffi->TEST_THREE);
36var_dump($ffi->TEST_FOUR);
37var_dump($ffi->TEST_FIVE);
38var_dump($ffi->TEST_SIX);
39?>
40--EXPECT--
41int(1)
42int(2)
43int(3)
44int(4)
45int(5)
46int(6)
47