Bug #72043 [Opn]: preg_match restart Apache (Not with PHP 7.0.x or 5.5.x)

From: Date: Fri, 29 Apr 2016 09:13:12 +0000
Subject: Bug #72043 [Opn]: preg_match restart Apache (Not with PHP 7.0.x or 5.5.x)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200823@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72043&edit=1 ID: 72043 User updated by: dominique at ottello dot net Reported by: dominique at ottello dot net Summary: preg_match restart Apache (Not with PHP 7.0.x or 5.5.x) Status: Open Type: Bug -Package: Apache related +Package: PCRE related Operating System: Windows 7 64bit PHP Version: 5.6.20 Block user comment: N Private report: N New Comment: PHP version 5.6.21 doesn't correct this problem. Apache crashes with all versions of PHP 5.6. and works fine with other versions like 5.5.45 or 7.0.0 to 7.0.6 Previous Comments: ------------------------------------------------------------------------ [2016-04-18 08:15:12] dominique at ottello dot net The problem was detected with the 32-bit versions of Apache and PHP, but is exactly the same with 64-bit versions. ------------------------------------------------------------------------ [2016-04-17 12:28:42] dominique at ottello dot net Description: ------------ Execution of this code works fine with Apache 2.4.16 to 2.4.20 and PHP 5.3.29, 5.4.45, 5.5.30 or 7.0.5 but crash and restart Apache with PHP 5.6.15 to 5.6.20 AH00428: Parent: child process 5912 exited with status 255 -- Restarting. All things otherwise identical, the problem occurs only with PHP 5.6.15 to 5.6.20. I have not tested with versions prior to 5.6.15. Test script: --------------- $c_vhostConfFile = 'myfile.conf'; //myfile.conf is a copy of: //$c_vhostConfFile = 'j:/wamp/bin/apache/apache2.4.20/conf/extra/httpd-vhosts.conf'; $myVhostsContents = file_get_contents($c_vhostConfFile); // ServerName to find $server = "wampserver.aviatechno"; $p_value = preg_quote($server); $mask = "{ <VirtualHost # beginning of VirtualHost ((?!</VirtualHost>).)* # avoid premature end \n\s*ServerName\s+${p_value}\s*\n # Test server name .*? # we stop as soon as possible </VirtualHost>\s*\n # end of VirtualHost }isx"; if(preg_match($mask, $myVhostsContents, $VirtualHost_match) !== false) echo "<pre>".htmlspecialchars($VirtualHost_match[0])."</pre>\n"; else echo "<p>preg_match error</p>\n"; ?> Expected result: ---------------- The whole content of the VirtualHost definition that is: <VirtualHost *:80> DocumentRoot "G:/www/wampserver" ServerAdmin webmaster@ottello.net ServerAlias www.wampserser.aviatechno ServerName wampserver.aviatechno <Directory "G:/www/wampserver/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride all Require local </Directory> </VirtualHost> Actual result: -------------- Apache crash and restart. No error in php_error.log ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72043&edit=1

« previous php.bugs (#200823) next »