RE: [PEAR] NNTP Breaking
| From: | Hoffman, Geoffrey | Date: | Fri, 30 May 2003 17:55:25 +0000 |
| Subject: | RE: [PEAR] NNTP Breaking | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5722@lists.php.net to get a copy of this message | ||
FWIW, I figured out what the problem was. Maybe this will help someone in
the future, so I'm posting my findings.
In the demo file "group.php" that comes with the Net_NNTP class, line 64:
$msgs = array_reverse($nntp->getOverview( $msgcount-9, $msgcount));
doesn't work correctly if the messages on the newsserver aren't numbered
from 1 to $mgscount.
I did a var_dump($msgdata) on line 63, which was correctly returning
"first"=>"40400", "last"=>"40500"
So the messagecount = 100 (correct) but the code $nntp->getOverview(90,100)
failed (technically it didn't fail, it just returned '.' which is actually
correct since there are no messages numbered 90 - 100.
I changed line 64 to read:
$msgs = array_reverse($nntp->getOverview( (int)$msgdata["last"]-9,
(int)$msgdata["last"] ));
which calls $nntp->getOverview(40590, 40500) using the correct article-nums,
and it worked as expected.
One other thing I found in the demo files was that the location of the
Net_NNTP class file wasn't the same in index.php, groups.php, and read.php.
I had to change them all to require_once "Net/NNTP.php" and move NNTP.php to
the Net folder.
Should I send my updated code to the developer(s) - or is there a standard
policy for updating PEAR classes when you're not the original author?
Geoff Hoffman