Download src/php/php-src/Zend/tests/array_unpack/already_occupied.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 753 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/array_unpack/already_occupied.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/array_unpack/already_occupied.phpt
-
curl -L -o already_occupied.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/array_unpack/already_occupied.phpt
753 Bytes
| --TEST-- | |
| Appending to an array via unpack may fail | |
| --SKIPIF-- | |
| if (PHP_INT_SIZE != 8) die("skip 64bit only"); | |
| --FILE-- | |
| $arr = [1, 2, 3]; | |
| try { | |
| var_dump([PHP_INT_MAX-1 => 0, ...$arr]); | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| try { | |
| var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]); | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| const ARR = [1, 2, 3]; | |
| function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {} | |
| try { | |
| test(); | |
| } catch (Error $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| --EXPECT-- | |
| Cannot add element to the array as the next element is already occupied | |
| Cannot add element to the array as the next element is already occupied | |
| Cannot add element to the array as the next element is already occupied | |