Menu

#3 Problem with preg_match_all in phpcrawlerutils.class.php

open
nobody
None
5
2009-07-27
2009-07-27
Anonymous
No

In file: phpcrawlerutils.class.php 201
if there is strlen($source) >= 400000 preg_match_all produces a segmentation fault.

I solved the problem adding this:

if ( strlen($source) > 50000 ) {
$source = substr($source, 0, 50000);
}
preg_match_all("/<[ ]{0,}a[ \n\r][^<>]{0,}(?<= |\n|\r)(?:".$match_part.")[ \n\r]{0,}=[ \n\r]{0,}[\"|']{0,1}([^\"'>< ]{0,})[^<>]{0,}>((?:(?!<[ \n\r]*\/a[ \n\r]*>).)*)<[ \n\r]*\/a[ \n\r]*>/ is", $source, $regs);

You can contact me at: <a href="http://www.informaticaautonomos.com">http://www.informaticaautonomos.com</a>

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.