|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-27 23:38 UTC] php at kaiundina dot de
Description:
------------
The statement in the reproduce code simply crashes my server (Win XP Pro, Apache 2, PHP 5.1.0, default-charset UTF 8) and that of my webhoster (Linux, Apache 2, PHP 5.1.2, default-charset Latin1) - time_limit, which is set to 30 s seems not to work.
Executing the script via CLI produces the same result (but can be cancelled by Ctrl-C)
The snipped shall look for adjacent blocks, each persisting of a separator character followed by one or more characters that aren't control- or separator-characters.
Crashing is independent of the $aName-value and the result, the match would produce.
The example is stripped down from a bigger pattern - always having to kill the webserver after each test is quite annoying :(
Reproduce code:
---------------
<?php
$aName = 'My Name';
preg_match('/^(\\p{Z}[^\\p{C}\\p{Z}]+)*$/', $aName);
?>
Expected result:
----------------
just nothing happens - the function returns and drops its result (false in this case, but doesn't matter)
Actual result:
--------------
Server "crashes": CPU usage is at 100% and Apache doesn't respond to a restart (php compiled as module).
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Not a php issue - thanks anyway for the quick response. PCRE runs into an infinite loop rather than returning an error/warning. Unicode patterns should be used along with the PCRE_UTF8 option (my fault). Looks and works like follows (note the additional 'u' as pattern option): <?php $aName = 'My Name'; preg_match('/^(\\p{Z}[^\\p{C}\\p{Z}]+)*$/u', $aName); ?>