From e4e6c0654dd56a491c1a3a1d4b3a9ba60c69a628 Mon Sep 17 00:00:00 2001 From: Ryan Volz Date: Thu, 1 Jun 2017 19:40:56 -0400 Subject: [PATCH] Wrap all DOMNodeLists in iterator_to_array for compatibility --- src/phpbbRemoteApi/phpbbRemoteApi.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/phpbbRemoteApi/phpbbRemoteApi.php b/src/phpbbRemoteApi/phpbbRemoteApi.php index 56489d9..b3d9f12 100644 --- a/src/phpbbRemoteApi/phpbbRemoteApi.php +++ b/src/phpbbRemoteApi/phpbbRemoteApi.php @@ -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]) { @@ -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) @@ -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)