mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
bd9f4fa676
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
53 lines
1.2 KiB
PHP
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
|