Bug #78272 [Com]: calling preg_match() before pcntl_fork() will freeze child process
| From: | dams@php.net | Date: | Wed, 10 Jul 2019 16:03:59 +0000 |
| Subject: | Bug #78272 [Com]: calling preg_match() before pcntl_fork() will freeze child process | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221694@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78272&edit=1
ID: 78272
Comment by: dams@php.net
Reported by: dams@php.net
Summary: calling preg_match() before pcntl_fork() will freeze
child process
Status: Open
Type: Bug
Package: PCRE related
Operating System: OSX
PHP Version: 7.3.7
Block user comment: N
Private report: N
New Comment:
pcre.jit=0 fixes the problem, both with PHP 7.3 and 7.4.
pcre.jit=1 behave the same with php 7.3 and 7.4.
Previous Comments:
------------------------------------------------------------------------
[2019-07-10 15:37:33] nikic@php.net
And also whether it works if you set pcre.jit=0.
------------------------------------------------------------------------
[2019-07-10 15:37:09] nikic@php.net
Is it possible for you test whether this works on 7.4 (has an updated PCRE2)?
------------------------------------------------------------------------
[2019-07-10 15:32:54] dams@php.net
Description:
------------
When preg_match (or another preg_*function) has been called before pcntl_fork(), and then, called
again in the child process, the child process stops at the preg_match, and just hangs.
No error, no crash.
This was tested on OSX, and it couldn't be replicated on Debian. This may be specific to OSX.
It is reproductible with PHP 7.3.7. It works on 7.2, 7.1.
It may be related to https://bugs.php.net/bug.php?id=77260
Test script:
---------------
<?php
// Uncomment the following to freeze child process
// preg_match('/abc/', 'abcde', $r);
$pid = pcntl_fork();
if ($pid === 0) {
print "Child start\n";
preg_match('/abc/', 'abcde', $r);
print_r($r);
print "End child\n";
exit(0);
} else {
print "Main start\n";
sleep(3);
print "End Main\n";
exit(0);
}
?>
Expected result:
----------------
Main start
Child start
Array
(
[0] => abc
)
End child
End Main
Actual result:
--------------
Main start
Child start
End Main
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78272&edit=1