Bug #72356 [Fbk->NoF]: Regular Expression causes Apache/PHP to crash

From: Date: Sun, 26 Jun 2016 04:22:26 +0000
Subject: Bug #72356 [Fbk->NoF]: Regular Expression causes Apache/PHP to crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201848@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72356&edit=1 ID: 72356 Updated by: php-bugs@lists.php.net Reported by: fred at generation10 dot net Summary: Regular Expression causes Apache/PHP to crash -Status: Feedback +Status: No Feedback Type: Bug Package: Regexps related Operating System: Windows 10 PHP Version: 5.6.22 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2016-06-07 16:23:23] cmb@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. I can't reproduce the issue on Windows 10 with the official php-5.6.22-nts-Win32-VC11-x64 nor on <https://3v4l.org/s6jQ7>. ------------------------------------------------------------------------ [2016-06-07 14:38:19] fred at generation10 dot net Description: ------------ We have a regular expression that removed nested comments from an HTML string. It was working OK in PHP 5.3 and 5.5 but crashes in PHP 5.6.20 and 5.6.22 The included test script is a very cut down version of string being processed. The number of characters seems to be important, removing some characters from the class names will make the script run but I can't figure the logic of it. PHP crashes without outputting any errors, I only have the Windows Event Log output: Faulting application name: httpd.exe, version: 2.4.12.0, time stamp: 0x550eaef9 Faulting module name: php5ts.dll, version: 5.6.22.0, time stamp: 0x57468b87 Exception code: 0xc00000fd Fault offset: 0x0011ddd2 Faulting process id: 0x1600 Faulting application start time: 0x01d1c0c7b01411c2 Faulting application path: C:\Apache24\bin\httpd.exe Faulting module path: C:\php-5.6.22\php5ts.dll Report Id: 23060e48-35e8-41c0-96e7-f75628bdf8f9 Faulting package full name: Faulting package-relative application ID: Test script: --------------- <?php $html = <<<EOT <div> <p>Hello World</p> <!-- <table class="123456789132456789123456789123456789123456789"> <tr class=""> <!--<td></td>--> <!--<td></td>--> <td class="123456789123456789123456789123456789123456789">FooBar</td> </tr> </table> --> </div> EOT; do { $html = preg_replace("/<!--(?(?!<!--).)*-->/sU", '', $html, -1, $count); } while ($count); echo $html; Expected result: ---------------- <div> <p>Hello World</p> </div> Actual result: -------------- Site can't be reached error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72356&edit=1

« previous php.bugs (#201848) next »