"Undefined Offset" in NNTP.php
Hello all,
Just tried using the newsreader functionality and the first site I added (news.microsoft.com) yielded the following:
Notice: Undefined offset: 1 in /var/www/html/tiki/lib/pear/NNTP.php on line 477
Notice: Undefined offset: 2 in /var/www/html/tiki/lib/pear/NNTP.php on line 477
(repeat about a hundred times)
The page displays normally after about 200 lines of "Notice"s. The code in NNTP.php around line 477 (with line 477 markled with an *) is as follows:
===== begin php code =====
/**
* Fetches a list of all avaible newsgroups
*
* @param int $fetch PEAR_NNTP_ALL PEAR_NNTP_NAMES PEAR_NNTP_LIST
* @return array nested array with informations about
* existing newsgroups
* @author Morgan Christiansson <mo...@li...>
*/
function getGroups($fetch = true)
{
$this->command("LIST");
foreach($this->_getData() as $line) {
$arr = explode(" ",$line);
$groups[$arr[0]]["group"] = $arr[0];
$groups[$arr[0]]["last"] = $arr[1];
$groups[$arr[0]]["first"] = $arr[2];
$groups[$arr[0]]["posting_allowed"] = $arr[3];
}
$this->command("LIST NEWSGROUPS");
foreach($this->_getData() as $line) {
preg_match("/^(.*?)\s(.*?$)/",$line,$matches);
--> $groups[$matches[1]]["desc"] = $matches[2];
}
return $groups;
}
===== end php code =====
Anyone have any ideas?
(Also, how do we fix the typo in the comment for the above code — "avaible" = "available"? It's not in a wiki... 😀 )