Download src/php/php-src/ext/ffi/tests/013.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/013.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/013.phpt
-
curl -L -o 013.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/013.phpt
1.65 kB
| --TEST-- | |
| FFI 013: Declaration priorities and constrains | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| $ffi = FFI::cdef(); | |
| $a = $ffi->new("int[1][2][3]"); | |
| var_dump(count($a)); | |
| var_dump(count($a[0])); | |
| var_dump(count($a[0][0])); | |
| try { | |
| var_dump($ffi->new("void")); | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| var_dump($ffi->new("void[1]")); | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| FFI::cdef("static int foo(int)[5];"); | |
| echo "ok\n"; | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| FFI::cdef("static int foo[5](int);"); | |
| echo "ok\n"; | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| FFI::cdef("static int foo(int)(int);"); | |
| echo "ok\n"; | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| FFI::cdef("typedef int foo[2][];"); | |
| echo "ok\n"; | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| try { | |
| FFI::cdef("typedef int foo[][2];"); | |
| echo "ok\n"; | |
| } catch (Throwable $e) { | |
| echo get_class($e) . ": " . $e->getMessage()."\n"; | |
| } | |
| --EXPECT-- | |
| int(1) | |
| int(2) | |
| int(3) | |
| FFI\ParserException: void type is not allowed at line 1 | |
| FFI\ParserException: void type is not allowed at line 1 | |
| FFI\ParserException: Function returning array is not allowed at line 1 | |
| FFI\ParserException: Array of functions is not allowed at line 1 | |
| FFI\ParserException: Function returning function is not allowed at line 1 | |
| FFI\ParserException: Only the leftmost array can be undimensioned at line 1 | |
| ok | |