Bug #78272 [Opn]: calling preg_match() before pcntl_fork() will freeze child process

From: Date: Wed, 10 Jul 2019 15:37:09 +0000
Subject: Bug #78272 [Opn]: calling preg_match() before pcntl_fork() will freeze child process
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221692@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 Updated by: nikic@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: Is it possible for you test whether this works on 7.4 (has an updated PCRE2)? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#221692) next »