BUGFIX Fix PHP notice where variable with array didn't exist in HTTP->findByTagAndAttribute()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66043 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-17 08:31:57 +00:00 committed by Sam Minnee
parent 3f154aaca1
commit 5df7e70cf8

View File

@ -104,6 +104,7 @@ class HTTP {
}
static function findByTagAndAttribute($content, $attribs) {
$regExps = array();
foreach($attribs as $tag => $attrib) {
if(!is_numeric($tag)) $tagPrefix = "$tag ";
@ -114,9 +115,11 @@ class HTTP {
$regExps[] = "/(<{$tagPrefix}[^>]*$attrib *= *)([^\"' ]*)( )/ie";
}
if($regExps) {
foreach($regExps as $regExp) {
$content = preg_replace($regExp, '$items[] = "$2"', $content);
}
}
return isset($items) ? $items : null;
}