Switch from regular expression which may not work in old/odd PHP.

This commit is contained in:
Andrew McMillan 2010-11-01 14:53:57 +13:00
parent 58b88437b3
commit 3e1451a5d0

View File

@ -68,8 +68,15 @@ foreach( $mg_hrefs AS $k => $v ) {
* anything up to the matching request->path (which will include any http...) and then
* put the $bound_from prefix back on.
*/
$href = $bound_from . preg_replace( "{^.*\E$request->path\Q}", '', rawurldecode($v->GetContent()) );
dbg_error_log("REPORT", "Reporting on href '%s'", $href );
$rawurl = rawurldecode($v->GetContent());
$path_pos = strpos($rawurl,$request->path);
if ( $path_pos === false ) {
$href = $bound_from . $rawurl;
}
else {
$href = $bound_from . substr( $rawurl, $path_pos + strlen($request->path));
}
@dbg_error_log("REPORT", 'Reporting on href "%s"', $href );
$href_in .= ($href_in == '' ? '' : ', ');
$href_in .= ':href'.$k;
$params[':href'.$k] = $href;