Download src/php/php-src/Zend/tests/ArrayAccess/bug64417.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 893 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/ArrayAccess/bug64417.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/ArrayAccess/bug64417.phpt
-
curl -L -o bug64417.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/ArrayAccess/bug64417.phpt
893 Bytes
| --TEST-- | |
| Bug #64417 (BC break: ArrayAccess::&offsetGet() in a trait causes fatal error) | |
| --FILE-- | |
| trait aa { | |
| private $container = array(); | |
| public function offsetSet($offset, $value): void { | |
| if (is_null($offset)) { | |
| $this->container[] = $value; | |
| } else { | |
| $this->container[$offset] = $value; | |
| } | |
| } | |
| public function offsetExists($offset): bool { | |
| return isset($this->container[$offset]); | |
| } | |
| public function offsetUnset($offset): void { | |
| unset($this->container[$offset]); | |
| } | |
| public function &offsetGet($offset): mixed { | |
| $result = null; | |
| if (isset($this->container[$offset])) { | |
| $result = &$this->container[$offset]; | |
| } | |
| return $result; | |
| } | |
| } | |
| class obj implements ArrayAccess { | |
| use aa; | |
| } | |
| $o = new obj; | |
| $o['x'] = 1; | |
| ++$o['x']; | |
| echo $o['x'], "\n"; | |
| --EXPECT-- | |
| 2 | |