Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#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