Call to undefined method DOMNodeList::hasChildNodes()
bookin opened this issue · 1 comments
bookin commented
Думаю что это ошибка, но не разбирался особо.
Дергаю $nokogiri->get('#login')->toText();
Получаю ошибку - Call to undefined method DOMNodeList::hasChildNodes()
Поизучал код, думаю проблема решается если добавить || $node instanceof DOMNodeList
в строку 261, в условие метода protected function _toTextArray()
protected function _toTextArray($node = null, $skipChildren = false, $singleLevel = true){
$array = array();
if ($node === null || $node instanceof DOMNodeList ){
if ($this->_dom instanceof DOMNodeList){
foreach ($this->_dom as $node){
if ($singleLevel){
$array = array_merge($array, $this->_toTextArray($node, $skipChildren, $singleLevel));
}else{
$array[] = $this->_toTextArray($node, $skipChildren, $singleLevel);
}
}
return $array;
}
$node = $this->getDom();
}
...
olamedia commented
исправил, проверьте