php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63840 preg_peplace crash
Submitted: 2012-12-23 16:19 UTC Modified: 2012-12-23 16:26 UTC
From: DuMOHsmol at yandex dot ru Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 5.3Git-2012-12-23 (snap) OS: Windows
Private report: No CVE-ID: None
 [2012-12-23 16:19 UTC] DuMOHsmol at yandex dot ru
Description:
------------
Hello, this code crashes Apache with PHP on Windows. I know that this regex is not quite correct, but still.

The solution is to increase Apache stack, but I think there should be some check in PHP to prevent crashing.

Test script:
---------------
$text = '
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
test_test_test_test_test_test_test_test_test_test_test_test_test_test_test
';

$text = preg_replace('/([\n]|.)*/','test',$text);

echo $text;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-23 16:26 UTC] felipe@php.net
See bug #63829
 [2012-12-23 16:26 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 23:03:34 2021 UTC