Bug #16657 [Fbk]: Net_NNTP problems with PHP 5.2.11
| From: | ddfly90 at googlemail dot com | Date: | Tue, 29 Sep 2009 20:08:37 +0000 |
| Subject: | Bug #16657 [Fbk]: Net_NNTP problems with PHP 5.2.11 | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-1770@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1
ID: 16657
Updated by: ddfly90@googlemail.com
Reported By: ddfly90 at googlemail dot com
Summary: Net_NNTP problems with PHP 5.2.11
Status: Feedback
Type: Bug
Package: Net_NNTP
Operating System: FreeBSD & Windows
Package Version: 1.4.0
-PHP Version: 5_2 CVS-2009-09-29
+PHP Version: 5.2.11
Roadmap Versions:
New Comment:
-PHP Version: 5_2 CVS-2009-09-29
+PHP Version: 5.2.11
Previous Comments:
------------------------------------------------------------------------
[2009-09-29 21:08:03] ddfly
The generated log isn't telling me anything significant, it seems the
script is randomly stopping after receiving a few thousand newsgroups:
FIRST LOG
=======
Sep 29 19:03:01 Net_NNTP [debug] S: 281 Welcome
Sep 29 19:03:01 Net_NNTP [debug] C: LIST ACTIVE
Sep 29 19:03:01 Net_NNTP [debug] S: 215 NewsGroups Follow
Sep 29 19:03:01 Net_NNTP [debug] T: .complete_cd 0000000037 0000000010
y
Sep 29 19:03:01 Net_NNTP [debug] T: .usa 0000000122 0000000017 y
Sep 29 19:03:01 Net_NNTP [debug] T: 0 0000000069 0000000025 y
[...snip...]
Sep 29 19:03:02 Net_NNTP [debug] T: agora.scienza.scienza 0000000003
0000000002 y
Sep 29 19:03:02 Net_NNTP [debug] T: agora.scienza.vatinno 0000000004
0000000002 y
Sep 29 19:03:02 Net_NNTP [debug] C: QUIT
Sep 29 19:03:02 Net_NNTP [debug] S:
1st time: Stops after 10,600th newsgroup
2nd time: Stops after 850th newsgroup
3rd time: Stops after 1,464th newsgroup
etc etc
I ran the same script on PHP 5.2.10 few times and it fetched all 107k
newsgroups fine, not sure why doesn't work on 5.2.11
SOURCE CODE
==========
require_once('Log.php');
require_once('Net/NNTP/Client.php');
$file = &Log::factory('file', 'log.txt', 'Net_NNTP');
$nntp = new Net_NNTP_Client();
$nntp->setLogger($file);
$nntp->connect('news.example.com', false, 119);
$nntp->authenticate('username', 'password');
$server_newsgroups = $nntp->getGroups();
$nntp->quit();
if (PEAR::isError($server_newsgroups)) {
echo 'Fetching list of groups failed: ' .
$server_newsgroups->getMessage();
exit;
}
foreach ($server_newsgroups as $server_newsgroup) {
$newsgroups[] = $server_newsgroup['group'];
}
natcasesort($newsgroups);
file_put_contents('output.txt', implode("\r\n", $newsgroups));
------------------------------------------------------------------------
[2009-09-29 19:22:22] heino
-Status: Open
+Status: Feedback
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PEAR.
Hi Jim,
I simply can't help you based on the provided information! Aparently
the servers termination of its response is not registered...
You could use the PEAR logger class to make dump of the conversation
between server and client. An example on how to use it can be found in
the example application
(http://svn.php.net/viewvc/pear/packages/Net_NNTP/trunk/docs/examples/demo/common.inc.php?revision=261287&view=markup)
provided with the Net_NNTP class.
------------------------------------------------------------------------
[2009-09-29 13:03:33] ddfly
Description:
------------
While a script used to work with PHP 5.2.10 and earlier versions on
both FreeBSD and Windows, now no longer works with the latest version of
PHP 5.2.11:
Error Message:
Data stream not terminated with period
Tested on default PHP installations confirms that a change between
5.2.10 and 5.2.11 broke something with Net_NNTP. Haven't tested on PHP
5.3.0 yet.
Test script:
---------------
require_once('Net/NNTP/Client.php');
$NNTP = new Net_NNTP_Client();
$NNTP->connect('news.example.com', false, 119);
$NNTP->authenticate('username', 'password');
$newsgroups = $NNTP->getGroups();
if (PEAR::isError($newsgroups)) {
echo 'Fetching list of groups failed: ' . $newsgroups->getMessage();
exit;
}
var_dump($newsgroups);
Expected result:
----------------
Array dump of $newsgroups
Actual result:
--------------
Fetching list of groups failed: Data stream not terminated with period
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16657&edit=1