Skip to content

Commit

Permalink
Wrap all DOMNodeLists in iterator_to_array for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
iggyvolz committed Jun 1, 2017
1 parent e845d52 commit e4e6c06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/phpbbRemoteApi/phpbbRemoteApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function get_id_from_user($u)
{
return null;
}
$a=$rows[0]->getElementsByTagName("a")[0];
$a=iterator_to_array($rows[0]->getElementsByTagName("a"))[0];
preg_match("/\.\/memberlist.php\?mode=viewprofile&u=([0-9]+)/", $a->getAttribute("href"),$matches);
if($matches[1])
{
Expand Down Expand Up @@ -273,9 +273,9 @@ public function __construct($url,$f,$t,$s,$result)
{
return in_array("author",explode(" ",$el->getAttribute("class")));
}))[0];
preg_match("/\.\/viewtopic.php\?p=([0-9]+)/", $authorblock->getElementsByTagName("a")[0]->getAttribute("href"), $arr);
preg_match("/\.\/viewtopic.php\?p=([0-9]+)/", iterator_to_array($authorblock->getElementsByTagName("a"))[0]->getAttribute("href"), $arr);
$this->p=(int)$arr[1];
$this->author=$authorblock->getElementsByTagName("a")[1]->textContent;
$this->author=iterator_to_array($authorblock->getElementsByTagName("a"))[1]->textContent;
preg_match("/» (.+) /",$authorblock->textContent,$arr);
$this->time=new \DateTime($arr[1]);
$content=array_values(array_filter(iterator_to_array($result->getElementsByTagName("div")),function($el)
Expand Down Expand Up @@ -392,7 +392,7 @@ public function __construct($url,$p)
}
return;
}
$this->author=$authorblock->getElementsByTagName("a")[0]->textContent;
$this->author=iterator_to_array($authorblock->getElementsByTagName("a"))[0]->textContent;
preg_match("/Sent: (.+)/",$authorblock->textContent,$arr);
$this->time=new \DateTime($arr[1]);
$content=array_values(array_filter(iterator_to_array($result->getElementsByTagName("div")),function($el)
Expand Down

0 comments on commit e4e6c06

Please sign in to comment.