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
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: 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 21 14:01:32 2024 UTC