php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48907 Apache restarts due to a regular expression
Submitted: 2009-07-13 19:35 UTC Modified: 2009-07-16 19:19 UTC
From: sworddragon2 at aol dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.3.0 OS: Windows XP Professional SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sworddragon2 at aol dot com
New email:
PHP Version: OS:

 

 [2009-07-13 19:35 UTC] sworddragon2 at aol dot com
Description:
------------
I found a regular expression with which i can restart the apache service with the notification: [notice] Parent: child process exited with status 3221225477 -- Restarting. I'm using Apache 2.2.11.

Reproduce code:
---------------
<?php
preg_replace('#a((?:.|\n)*?)a#','a$1a','a11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111a');
?>

Expected result:
----------------
I expected that preg_replace() repaces the string.

Actual result:
--------------
Apache restarts with the above message an Firefox 3.5 tells me that the connection to the server was recessed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-15 12:08 UTC] jani@php.net
Exactly what PHP version are you using? This works fine on both 5.2.10 and 5.3.0 for me..
 [2009-07-16 00:56 UTC] sworddragon2 at aol dot com
I'm using PHP 5.3.0 x86 VC6 Thread Safe. I have installed PHP 5.2.10 and can reproduce it too. After this i have installed PHP 5.3.0 again without any extensions and have used a standard php.ini and httpd.conf (just the entry from the PHP installer is written).

I have cleared the error.log from Apache and after executing the reproduce code the log says:

[Thu Jul 16 02:40:03 2009] [notice] Parent: child process exited with status 3221225477 -- Restarting.
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2 for ServerName
[Thu Jul 16 02:40:03 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Thu Jul 16 02:40:03 2009] [notice] Server built: Dec 10 2008 00:10:06
[Thu Jul 16 02:40:03 2009] [notice] Parent: Created child process 3196
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2 for ServerName
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2 for ServerName
[Thu Jul 16 02:40:03 2009] [notice] Child 3196: Child process is running
[Thu Jul 16 02:40:03 2009] [notice] Child 3196: Acquired the start mutex.
[Thu Jul 16 02:40:03 2009] [notice] Child 3196: Starting 64 worker threads.
[Thu Jul 16 02:40:03 2009] [notice] Child 3196: Starting thread to listen on port 80.


But i figured out another thing. If I'm changing the pattern from '#a((?:.|\n)*?)a#' to '#a((?:\n|.)*?)a#' all works fine. Oddly seems that Avira AntiVir Personal with the definition file from the last days and today says after saving the reproduce code that the file is a heuristic found HEUR/HTML.Malware.
 [2009-07-16 13:34 UTC] jani@php.net
Check for these in your php.ini:

[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
;pcre.backtrack_limit=100000

;PCRE library recursion limit.
;Please note that if you set this value to a high number you may consume all
;the available process stack and eventually crash PHP (due to reaching the
;stack size limit imposed by the Operating System).
; http://php.net/pcre.recursion-limit
;pcre.recursion_limit=100000

 [2009-07-16 18:52 UTC] sworddragon2 at aol dot com
In the PCRE block of my php.ini stands the same:

[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
;pcre.backtrack_limit=100000

;PCRE library recursion limit. 
;Please note that if you set this value to a high number you may consume all 
;the available process stack and eventually crash PHP (due to reaching the 
;stack size limit imposed by the Operating System).
; http://php.net/pcre.recursion-limit
;pcre.recursion_limit=100000
 [2009-07-16 19:19 UTC] pajoye@php.net
There was already many bug reports about this issue, that's not something we can change from php. See #47689.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC