vovanmozg / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

markupToPHP regex match size limit #125

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Following regex from markupToPHP:
<php>\s*<!--(.*?)-->\s*</php>
have a character amount limit (around 100 000) inside <php> tags. This is
caused by lazy match (.*?). Using greedy (.*), limit isn't present.

Possible solutions:
- manual grammar parsing
- matching first-to-last with greedy match, then splitting and parsing each
part separately

Code to reproduce:
$doc = phpQuery::newDocument('<div id="content"></div>');
$content_string = str_repeat('a', 99988);
pq('#content')->php('echo '.var_export($content_string, true));
eval('?>'.$doc->php());

Source discussion:
http://groups.google.com/group/phpquery/browse_thread/thread/e8f9b12e75100a67

Original issue reported on code.google.com by tobiasz....@gmail.com on 27 Apr 2009 at 6:29