xref: /php-src/ext/ffi/tests/bug79576.phpt (revision 50f58c89)
1--TEST--
2Bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
3--EXTENSIONS--
4ffi
5--SKIPIF--
6<?php
7if (PHP_DEBUG || getenv('SKIP_ASAN')) echo "xleak FFI cleanup after parser error is nor implemented";
8?>
9--FILE--
10<?php
11try {
12	FFI::cdef('struct tree *get_tree(const oid *, size_t, struct tree *);');
13} catch (Throwable $e) {
14	echo get_class($e) . ": " . $e->getMessage()."\n";
15}
16try {
17	FFI::cdef('struct tree *get_tree(oid, size_t, struct tree *);');
18} catch (Throwable $e) {
19	echo get_class($e) . ": " . $e->getMessage()."\n";
20}
21try {
22	FFI::cdef('
23typedef struct _simple_struct {
24        const some_not_declared_type **property;
25    } simple_struct;
26');
27} catch (Throwable $e) {
28	echo get_class($e) . ": " . $e->getMessage()."\n";
29}
30?>
31DONE
32--EXPECT--
33FFI\ParserException: Undefined C type "oid" at line 1
34FFI\ParserException: Undefined C type "oid" at line 1
35FFI\ParserException: Undefined C type "some_not_declared_type" at line 3
36DONE
37