|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-25 20:02 UTC] mfburdett at gmail dot com
Description:
------------
preg_match_all with a particular regexp causes a run-away Apache/PHP processes which consumes all available CPU. This is on amd64 architecture; FreeBSD 6.2; PCRE 7.0 and PHP 5.2.1 installed through FreeBSD ports.
Reproduce code:
---------------
$regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x';
preg_match_all($regexp, $string, $matches);
Expected result:
----------------
It should compile and execute.
Actual result:
--------------
Process consumes all available CPU until killed.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 01:00:01 2025 UTC |
<?php $regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'; preg_match_all($regexp, $string, $matches); ?><?php $regexp = '%(?:^|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",]*))%x'; $string = ''; preg_match_all($regexp, $string, $matches); ?>