php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39459 /(.?)/ bugs on big string
Submitted: 2006-11-10 12:21 UTC Modified: 2006-11-10 12:35 UTC
From: dmitrysp at yandex dot ru Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 5.2.0 OS: Windows 2000/XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dmitrysp at yandex dot ru
New email:
PHP Version: OS:

 

 [2006-11-10 12:21 UTC] dmitrysp at yandex dot ru
Description:
------------
Expression "<table>(.*?)</table>" not work with big text string. On PHP 4 & 5.1.2 - all ok. memory_limit = 128M

Reproduce code:
---------------
Windows XP, PHP 5.2.0:

$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0 

$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1 


Windows 2000, PHP 5.2.0:

$buf="A".str_repeat("x",99997)."B"; // 99 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0 

$buf="A".str_repeat("x",99996)."B"; // 99 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1 


Windows 2000, PHP 4.4.2:

$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0 

$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1 


Windows 2000, PHP 5.1.2:

$buf="A".str_repeat("x",9999997)."B"; // 9 999 997
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 0 

$buf="A".str_repeat("x",9999996)."B"; // 9 999 996
var_dump(preg_match("!A(.*)B!is", $buf, $ok));  // 1
var_dump(preg_match("!A(.*?)B!is", $buf, $ok)); // 1 


Actual result:
--------------
Please up this memory block from 99Kb to <memory_limit> on Windows 2000!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-10 12:35 UTC] tony2001@php.net
It has nothing to do with memory_limit, it's MATCH_LIMIT set in PCRE library in compile time.
You can change it on *nix, but you have to live with that on win32, unless you want to build PHP on win32 yourself.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 14:01:28 2024 UTC