php-src/ext/ffi/tests/028.phpt
Max Semenik bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00

53 lines
1.2 KiB
PHP

--TEST--
FFI 028: Incomplete arrays inside structure
--EXTENSIONS--
ffi
--INI--
ffi.enable=1
--FILE--
<?php
try {
FFI::cdef("struct _x {int a; int b[0];};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("struct _x {int a; int b[];};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("struct _x {int a[0]; int b;};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("struct _x {int a[]; int b;};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("struct _x { struct {int a; int b[];}; int c;};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
FFI::cdef("union _x {int a; int b[];};");
echo "ok\n";
} catch (Throwable $e) {
echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
ok
ok
ok
FFI\ParserException: Flexible array member not at end of struct at line 1
FFI\ParserException: Flexible array member not at end of struct at line 1
FFI\ParserException: Flexible array member in union at line 1