Download src/php/php-src/ext/pcre/tests/bug69864.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug69864.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/pcre/tests/bug69864.phpt
-
curl -L -o bug69864.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pcre/tests/bug69864.phpt
1.21 kB
| --TEST-- | |
| Bug #69864 (Segfault in preg_replace_callback) | |
| --SKIPIF-- | |
| if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | |
| --FILE-- | |
| /* CAUTION: this test will most likely fail with valgrind until --smc-check=all is used. */ | |
| const PREG_CACHE_SIZE = 4096; // this has to be >= the resp. constant in php_pcre.c | |
| var_dump(preg_replace_callback('/a/', function($m) { | |
| for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { | |
| preg_match('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); | |
| } | |
| return 'b'; | |
| }, 'aa')); | |
| var_dump(preg_replace_callback('/a/', function($m) { | |
| for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { | |
| preg_replace('/foo' . $i . 'bar/', 'baz', '???foo' . $i . 'bar???'); | |
| } | |
| return 'b'; | |
| }, 'aa')); | |
| var_dump(preg_replace_callback('/a/', function($m) { | |
| for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { | |
| preg_split('/foo' . $i . 'bar/', '???foo' . $i . 'bar???'); | |
| } | |
| return 'b'; | |
| }, 'aa')); | |
| var_dump(preg_replace_callback('/a/', function($m) { | |
| for ($i = 0; $i < PREG_CACHE_SIZE; $i++) { | |
| preg_grep('/foo' . $i . 'bar/', ['???foo' . $i . 'bar???']); | |
| } | |
| return 'b'; | |
| }, 'aa')); | |
| --EXPECT-- | |
| string(2) "bb" | |
| string(2) "bb" | |
| string(2) "bb" | |
| string(2) "bb" | |