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