Download src/php/php-src/Zend/tests/foreach/bug34467.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug34467.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/foreach/bug34467.phpt
-
curl -L -o bug34467.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug34467.phpt
400 Bytes
| --TEST-- | |
| Bug #34467 (foreach + __get + __set inconsistency) | |
| --FILE-- | |
| class abc { | |
| private $arr; | |
| function __set ($key, $value) { | |
| $this->arr[$key] = $value; | |
| } | |
| function __get ($key) { | |
| return $this->arr[$key]; | |
| } | |
| } | |
| $abc = new abc(); | |
| foreach (array (1,2,3) as $abc->k => $abc->v) { | |
| var_dump($abc->k,$abc->v); | |
| } | |
| --EXPECT-- | |
| int(0) | |
| int(1) | |
| int(1) | |
| int(2) | |
| int(2) | |
| int(3) | |