mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +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
69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
--TEST--
|
|
FFI 015: Incomplete type usage
|
|
--EXTENSIONS--
|
|
ffi
|
|
--INI--
|
|
ffi.enable=1
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
FFI::cdef("struct DIR; static struct DIR dir;");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; static struct DIR *ptr;");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; static struct DIR foo();");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; static struct DIR* foo();");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; static void foo(struct DIR);");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
try {
|
|
FFI::cdef("struct DIR; static void foo(struct DIR*);");
|
|
echo "ok\n";
|
|
} catch (Throwable $e) {
|
|
echo get_class($e) . ": " . $e->getMessage()."\n";
|
|
}
|
|
?>
|
|
ok
|
|
--EXPECT--
|
|
FFI\ParserException: Incomplete struct "DIR" at line 1
|
|
ok
|
|
FFI\ParserException: Incomplete struct "DIR" at line 1
|
|
ok
|
|
ok
|
|
ok
|
|
ok
|
|
ok
|
|
ok
|