php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38594 RegExp cause server crash
Submitted: 2006-08-25 17:08 UTC Modified: 2006-08-26 05:56 UTC
From: o dot veujoz at free dot fr Assigned:
Status: Closed Package: PCRE related
PHP Version: 5.1.5 OS: Windows XP
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: o dot veujoz at free dot fr
New email:
PHP Version: OS:

 

 [2006-08-25 17:08 UTC] o dot veujoz at free dot fr
Description:
------------
Since php 5.1.5 & 5.1.6 the following piece of code cause a server crash, either on IIS 5.1 / Apache 2.0.59 (under windows XP, not tried on other platform).

The regexp is from Pear::Wiki_Text library and was working with older PHP versions (including 5.1.4).

Under IIS, I've got the message : "PHP has encountered a Stack overflow"

No message with Apache...

I read a lot of things on this error (such as bad regexp writing), but this time it is not a specific IIS case.

Removing the PCRE_DOTALL regexp option and the script works (but the result is not what expected...).

I read the bug #28317 and was wondering if it wasn't the same compilation problem ("Thus NO_RECURSE should be set in win32 compiler options").

Best regards,
Olivier (from France, sorry for the spelling faults)

Reproduce code:
---------------
<?php
// Uncomment one line and it works again ??
$text  = '<code type="php">
include_once("adodb/session/adodb-session2.php");
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
ADOdb_Session::config($driver=\'mysql\', $host, $user, $password, $database,$options=false);
session_start();
</code>';

$regex = ';^<code(\s[^>]*)?>((?:(?R)|.)*?)\n</code>(\s|$);msi';

preg_match_all($regex, $text, $match);

print '<xmp>';
print_r($match);
print '</xmp>';
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-25 21:37 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-08-26 05:56 UTC] o dot veujoz at free dot fr
It perfectly works with the last build.

Thank you Tony (and the team) for the great job.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC