Download src/php/php-src/ext/pcre/tests/bug44214.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug44214.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/pcre/tests/bug44214.phpt
-
curl -L -o bug44214.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug44214.phpt
517 Bytes
| --TEST-- | |
| Bug #44214 (crash with preg_replace_callback() and global variable) | |
| --FILE-- | |
| $string = 'aaa bbb ccc ddd eee ccc aaa bbb'; | |
| $array = array(); | |
| function myCallBack( $match ) { | |
| global $array; | |
| $array[] = $match; | |
| return 'xxx'; | |
| } | |
| var_dump(preg_replace_callback( '`a+`', 'myCallBack', $string)); | |
| var_dump($array); | |
| --EXPECT-- | |
| string(31) "xxx bbb ccc ddd eee ccc xxx bbb" | |
| array(2) { | |
| [0]=> | |
| array(1) { | |
| [0]=> | |
| string(3) "aaa" | |
| } | |
| [1]=> | |
| array(1) { | |
| [0]=> | |
| string(3) "aaa" | |
| } | |
| } | |