xref: /PHP-8.2/ext/pcre/tests/bug78272.phpt (revision 74859783)
1--TEST--
2Bug #78272: calling preg_match() before pcntl_fork() will freeze child process
3--EXTENSIONS--
4pcntl
5--FILE--
6<?php
7preg_match('/abc/', 'abcde', $r);
8
9$pid = pcntl_fork();
10if ($pid === 0) {
11    print "Child start\n";
12    preg_match('/abc/', 'abcde', $r);
13    print_r($r);
14    print "End child\n";
15    exit(0);
16} else {
17    pcntl_waitpid($pid, $status);
18    print "End Main\n";
19    exit(0);
20}
21?>
22--EXPECT--
23Child start
24Array
25(
26    [0] => abc
27)
28End child
29End Main
30