FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1

ID: 16657
Updated by: heino@gehlsen.dk
Reported By: ddfly90 at googlemail dot com
Summary: Net_NNTP problems with PHP 5.2.11
-Status: Open
+Status: Feedback
Type: Bug
Package: Net_NNTP
Operating System: FreeBSD & Windows
Package Version: 1.4.0
PHP Version: 5_2 CVS-2009-09-29
Roadmap Versions:
New Comment:

-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.


Previous Comments:
------------------------------------------------------------------------

[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

------------------------------------------------------------------------

Search Discussions

  • Ddfly90 at Sep 29, 2009 at 7:08 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1

    ID: 16657
    Comment 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
    Roadmap Versions:
    New Comment:

    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));


    Previous Comments:
    ------------------------------------------------------------------------

    [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

    ------------------------------------------------------------------------
  • Ddfly90 at Sep 29, 2009 at 7:08 pm
    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

    ------------------------------------------------------------------------
  • Ddfly90 at Sep 29, 2009 at 7:08 pm
    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
    +Status: Open
    Type: Bug
    Package: Net_NNTP
    Operating System: FreeBSD & Windows
    Package Version: 1.4.0
    PHP Version: 5.2.11
    Roadmap Versions:
    New Comment:

    -Status: Feedback
    +Status: Open



    Previous Comments:
    ------------------------------------------------------------------------

    [2009-09-29 21:08:37] ddfly

    -PHP Version: 5_2 CVS-2009-09-29
    +PHP Version: 5.2.11


    ------------------------------------------------------------------------

    [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

    ------------------------------------------------------------------------
  • Heino at Sep 29, 2009 at 9:12 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1

    ID: 16657
    Updated by: heino@gehlsen.dk
    Reported By: ddfly90 at googlemail dot com
    Summary: Net_NNTP problems with PHP 5.2.11
    Status: Open
    Type: Bug
    Package: Net_NNTP
    Operating System: FreeBSD & Windows
    Package Version: 1.4.0
    PHP Version: 5.2.11
    Roadmap Versions:
    New Comment:

    If you are sure the server actually rthe terminating peiod, my guess
    would be that you might be thrown out of the while loop in the
    _getTextResponse() method because of no more data available. It’s only
    a desperate thought however…

    Could you please try to make an eternal loop at
    NNTP/Protocol/Client.php line 321?
    Change
    while(!$this->_socket->eof()) {
    into
    while (true) {

    You could also try to increase the socket timeout:
    $nntp->_socket->setTimeout($seconds, $microseconds);
    (http://pear.php.net/manual/en/package.networking.net-socket.settimeout.php)


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-09-29 21:08:44] ddfly

    -Status: Feedback
    +Status: Open


    ------------------------------------------------------------------------

    [2009-09-29 21:08:37] ddfly

    -PHP Version: 5_2 CVS-2009-09-29
    +PHP Version: 5.2.11


    ------------------------------------------------------------------------

    [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

    ------------------------------------------------------------------------
  • Ddfly90 at Sep 30, 2009 at 6:19 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1

    ID: 16657
    Comment by: ddfly90@googlemail.com
    Reported By: ddfly90 at googlemail dot com
    Summary: Net_NNTP problems with PHP 5.2.11
    Status: Open
    Type: Bug
    Package: Net_NNTP
    Operating System: FreeBSD & Windows
    Package Version: 1.4.0
    PHP Version: 5.2.11
    Roadmap Versions:
    New Comment:

    while (true)

    That seems to have fixed the problem. Tested it many times and it
    fetched all 107k newsgroups fine, reverting it back saw the problem
    return.

    Changing the socket timeout had no effect.


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-09-29 23:12:43] heino

    If you are sure the server actually rthe terminating peiod, my guess
    would be that you might be thrown out of the while loop in the
    _getTextResponse() method because of no more data available. It’s only
    a desperate thought however…

    Could you please try to make an eternal loop at
    NNTP/Protocol/Client.php line 321?
    Change
    while(!$this->_socket->eof()) {
    into
    while (true) {

    You could also try to increase the socket timeout:
    $nntp->_socket->setTimeout($seconds, $microseconds);
    (http://pear.php.net/manual/en/package.networking.net-socket.settimeout.php)

    ------------------------------------------------------------------------

    [2009-09-29 21:08:44] ddfly

    -Status: Feedback
    +Status: Open


    ------------------------------------------------------------------------

    [2009-09-29 21:08:37] ddfly

    -PHP Version: 5_2 CVS-2009-09-29
    +PHP Version: 5.2.11


    ------------------------------------------------------------------------

    [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.

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=16657
  • Ddfly90 at Sep 30, 2009 at 8:07 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16657&edit=1

    ID: 16657
    Comment by: ddfly90@googlemail.com
    Reported By: ddfly90 at googlemail dot com
    Summary: Net_NNTP problems with PHP 5.2.11
    Status: Open
    Type: Bug
    Package: Net_NNTP
    Operating System: FreeBSD & Windows
    Package Version: 1.4.0
    PHP Version: 5.2.11
    Roadmap Versions:
    New Comment:

    http://bugs.php.net/bug.php?id=49706

    According to above, feof() is bad in 5.2.11 which is what Net_Socket
    uses on line 431 for eof()


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-09-30 08:19:06] ddfly

    while (true)

    That seems to have fixed the problem. Tested it many times and it
    fetched all 107k newsgroups fine, reverting it back saw the problem
    return.

    Changing the socket timeout had no effect.

    ------------------------------------------------------------------------

    [2009-09-29 23:12:43] heino

    If you are sure the server actually rthe terminating peiod, my guess
    would be that you might be thrown out of the while loop in the
    _getTextResponse() method because of no more data available. It’s only
    a desperate thought however…

    Could you please try to make an eternal loop at
    NNTP/Protocol/Client.php line 321?
    Change
    while(!$this->_socket->eof()) {
    into
    while (true) {

    You could also try to increase the socket timeout:
    $nntp->_socket->setTimeout($seconds, $microseconds);
    (http://pear.php.net/manual/en/package.networking.net-socket.settimeout.php)

    ------------------------------------------------------------------------

    [2009-09-29 21:08:44] ddfly

    -Status: Feedback
    +Status: Open


    ------------------------------------------------------------------------

    [2009-09-29 21:08:37] ddfly

    -PHP Version: 5_2 CVS-2009-09-29
    +PHP Version: 5.2.11


    ------------------------------------------------------------------------

    [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));

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=16657
  • Ddfly90 at Sep 30, 2009 at 5:59 pm
    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: Open
    +Status: Closed
    Type: Bug
    Package: Net_NNTP
    Operating System: FreeBSD & Windows
    Package Version: 1.4.0
    PHP Version: 5.2.11
    -Assigned To:
    +Assigned To: ddfly
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: ddfly



    Previous Comments:
    ------------------------------------------------------------------------

    [2009-09-30 10:06:54] ddfly

    http://bugs.php.net/bug.php?id=49706

    According to above, feof() is bad in 5.2.11 which is what Net_Socket
    uses on line 431 for eof()

    ------------------------------------------------------------------------

    [2009-09-30 08:19:06] ddfly

    while (true)

    That seems to have fixed the problem. Tested it many times and it
    fetched all 107k newsgroups fine, reverting it back saw the problem
    return.

    Changing the socket timeout had no effect.

    ------------------------------------------------------------------------

    [2009-09-29 23:12:43] heino

    If you are sure the server actually rthe terminating peiod, my guess
    would be that you might be thrown out of the while loop in the
    _getTextResponse() method because of no more data available. It’s only
    a desperate thought however…

    Could you please try to make an eternal loop at
    NNTP/Protocol/Client.php line 321?
    Change
    while(!$this->_socket->eof()) {
    into
    while (true) {

    You could also try to increase the socket timeout:
    $nntp->_socket->setTimeout($seconds, $microseconds);
    (http://pear.php.net/manual/en/package.networking.net-socket.settimeout.php)

    ------------------------------------------------------------------------

    [2009-09-29 21:08:44] ddfly

    -Status: Feedback
    +Status: Open


    ------------------------------------------------------------------------

    [2009-09-29 21:08:37] ddfly

    -PHP Version: 5_2 CVS-2009-09-29
    +PHP Version: 5.2.11


    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=16657

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedSep 29, '09 at 5:22p
activeSep 30, '09 at 5:59p
posts8
users3
websitepear.php.net

3 users in discussion

Ddfly90: 3 posts Ddfly90: 3 posts Heino: 2 posts

People

Translate

site design / logo © 2022 Grokbase