bug79576.phpt 956 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
  3. --EXTENSIONS--
  4. ffi
  5. --SKIPIF--
  6. <?php
  7. if (PHP_DEBUG || getenv('SKIP_ASAN')) echo "xfail: FFI cleanup after parser error is nor implemented";
  8. ?>
  9. --FILE--
  10. <?php
  11. try {
  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. }
  16. try {
  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. }
  21. try {
  22. FFI::cdef('
  23. typedef 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. ?>
  31. DONE
  32. --EXPECT--
  33. FFI\ParserException: Undefined C type "oid" at line 1
  34. FFI\ParserException: Undefined C type "oid" at line 1
  35. FFI\ParserException: Undefined C type "some_not_declared_type" at line 3
  36. DONE