Loading...
 
Features / Usability

Features / Usability


"Undefined Offset" in NNTP.php

posts: 5 United States

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 <mog@linux.nu>
     */
    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... biggrin )

posts: 1092

The NNTP library doesn't belong to tiki but it is a PEAR library.
To fix that we have to ask for an update/fix to the PEAR guys - or we have to rewrite the library.....
The point I know is that it is working for news.php.net
I suppose that microsoft is still outside the standard :-)
Can you do a bug report on Sourceforge not to forget the point
Thanks

Ps: you can also avoid the notice message to appear by configuring the php error report in admin / general