xref: /PHP-8.0/ext/pcre/tests/bug34790.phpt (revision 610c7fbe)
1--TEST--
2Bug #34790 (preg_match_all(), named capturing groups, variable assignment/return => crash)
3--FILE--
4<?php
5function func1(){
6        $string = 'what the word and the other word the';
7        preg_match_all('/(?P<word>the)/', $string, $matches);
8        return $matches['word'];
9}
10$words = func1();
11var_dump($words);
12?>
13--EXPECT--
14array(4) {
15  [0]=>
16  string(3) "the"
17  [1]=>
18  string(3) "the"
19  [2]=>
20  string(3) "the"
21  [3]=>
22  string(3) "the"
23}
24