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