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

From: Date: Sun, 17 Apr 2016 12:28:48 +0000
Subject: Bug #72043 [NEW]: preg_match restart Apache (Not with PHP 7.0.x or 5.5.x)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200613@lists.php.net to get a copy of this message
From: dominique at ottello dot net Operating system: Windows 7 64bit PHP version: 5.6.20 Package: Apache related Bug Type: Bug Bug description:preg_match restart Apache (Not with PHP 7.0.x or 5.5.x) 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 bug report at https://bugs.php.net/bug.php?id=72043&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72043&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72043&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72043&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72043&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72043&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72043&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72043&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72043&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72043&r=support Expected behavior: https://bugs.php.net/fix.php?id=72043&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72043&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72043&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72043&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72043&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72043&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72043&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72043&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72043&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72043&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72043&r=mysqlcfg

« previous php.bugs (#200613) next »