Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.4

Bug #14566 Error in parsing protocol
Submitted: 2008-08-26 19:24 UTC
From: hubbitus Assigned: hudeldudel
Status: Closed Package: Net_IMAP (version 1.0.3)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 22 + 33 = ?

 
 [2008-08-26 19:24 UTC] hubbitus (Pavel Alexeev)
Description: ------------ After call method getSummary(): PHP Notice: Uninitialized string offset: 214 in /usr/share/pear/Net/IMAPProtocol.php on line 2185 Notice: Uninitialized string offset: 214 in /usr/share/pear/Net/IMAPProtocol.php on line 2185 PHP Notice: Uninitialized string offset: 214 in /usr/share/pear/Net/IMAPProtocol.php on line 2193 Notice: Uninitialized string offset: 214 in /usr/share/pear/Net/IMAPProtocol.php on line 2193 PHP Notice: Uninitialized string offset: 215 in /usr/share/pear/Net/IMAPProtocol.php on line 2199 Notice: Uninitialized string offset: 215 in /usr/share/pear/Net/IMAPProtocol.php on line 2199 PHP Notice: Uninitialized string offset: 215 in /usr/share/pear/Net/IMAPProtocol.php on line 2200 Notice: Uninitialized string offset: 215 in /usr/share/pear/Net/IMAPProtocol.php on line 2200 2200,/usr/share/pear/Net/IMAPProtocol.php,PROTOCOL ERROR!:_getClosingBracesPos: must be a ) but is a ''|POS:215|STR_LINE:(NIL NIL {50} Eleftherios utyihkl" <erabgaar_2001@atnetwork.biz> "unspecified-domain")) ((NIL NIL "support" "o-range.ru")) NIL NIL NIL "<001101c904ff$7b7cae30$4bb9825d@PCHuber>")) A0007 OK Completed (0.000 sec) !!!! PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /usr/share/pear/Net/IMAPProtocol.php on line 2264 Fatal error: Maximum function nesting level of '100' reached, aborting! in /usr/share/pear/Net/IMAPProtocol.php on line 2264 ================== Notice warnings is a strange design issues, for example first: PHP Notice: Uninitialized string offset: 214 in /usr/share/pear/Net/IMAPProtocol.php on line 2185 On line 2185: while ( $str_line[$pos] != '"' && $pos < $len ) { got notice if $str_line hasn't index $post. And it is fixed only by change order of conditions: while ( $pos < $len && $str_line[$pos] != '"' ) { what is more logical in any case. But PROTOCOL ERROR is more serious. I'm capture tcp-session by Wireshark and decoded IMAP-answer which do not parsed was: A0007 FETCH 1 (RFC822.SIZE UID FLAGS ENVELOPE INTERNALDATE) * 1 FETCH (FLAGS () UID 800181 INTERNALDATE "23-Aug-2008 13:02:24 +0400" RFC822.SIZE 2229 ENVELOPE ("Sat, 23 Aug 2008 11:06:09 +0200" "Paris Hilton covered in excrement" ((NIL NIL {50} Eleftherios utyihkl" <erabgaar_2001@atnetwork.biz> "unspecified-domain")) ((NIL NIL {50} Eleftherios utyihkl" <erabgaar_2001@atnetwork.biz> "unspecified-domain")) ((NIL NIL {50} Eleftherios utyihkl" <erabgaar_2001@atnetwork.biz> "unspecified-domain")) ((NIL NIL "support" "o-range.ru")) NIL NIL NIL "<001101c904ff$7b7cae30$4bb9825d@PCHuber>")) A0007 OK Completed (0.000 sec) Test script: --------------- static $mailbox = 'inbox'; static $loginCount = 0; $imap = new Net_IMAP($host, $port); $imap->selectMailbox( $mailbox ); if ( !PEAR::isError( $num_messages = $imap->getNumberOfMessages( $mailbox ) ) ){ for($i=1; $i <= $num_messages; $i++) { if (! $imap->isDeleted($i)){//ANSWER! $curMsg = $imap->getSummary($i); var_dump($curMsg); }else{ echo "Or $mailbox has no messages or there was an error!\n"; } Expected result: ---------------- Var_dump of current messages in inbox IMAP-folder. Actual result: -------------- Errors. See description.

Comments

 [2008-12-10 15:02 UTC] hudeldudel (Sebastian Ebling)
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the CVS of the package. Please log into CVS with: cvs -d :pserver:cvsread@cvs.php.net:/repository login and check out the CVS repository of this package and upgrade cvs -d :pserver:cvsread@cvs.php.net:/repository co pear/Net_IMAP pear upgrade pear/Net_IMAP/package2.xml or pear upgrade pear/Net_IMAP/package.xml If you are able to reproduce the bug with the latest CVS, please change the status back to "Open". Again, thank you for your continued support of PEAR. I can not reproduce with current CVS version. Your description looks like problems with wrong clocing braces fixed some time ago in CVS. regards
 [2009-01-15 15:01 UTC] doconnor (Daniel O'Connor)
Hey if this one is fixed in CVS, can you link to a previous bug? Also, what are the chances of it becoming a release?
 [2009-03-23 14:18 UTC] kguest (Ken Guest)
running the test script as is I get the following: ken:~$ php test_imap.php Fatal error: Cannot use object of type PEAR_Error as array in /usr/share/php/Net/IMAPProtocol.php on line 1038 Call Stack: 0.0003 121672 1. {main}() /home/ken/test_imap.php:0 0.0320 2790744 2. Net_IMAP->getNumberOfMessages() /home/ken/test_imap.php:26 0.0320 2790744 3. Net_IMAPProtocol->cmdStatus() /usr/share/php/Net/IMAP.php:979 The return value from _genericCommand is not being checked for whether it is valid or a PEAR Error... The error message is "not connected!" btw. the amended/working test script should look like: require_once('Net/IMAP.php'); static $mailbox = 'inbox'; static $loginCount = 0; $user="example"; $passwd="password"; $host="localhost"; $port="143"; $imap= new Net_IMAP($host,$port); $authMethod=false; if ( PEAR::isError( $ret = $imap->login( $user , $passwd , $authMethod ) ) ) { echo "Unable to login! reason:" . $ret->getMessage() . "\n"; exit(); } $imap->selectMailbox( $mailbox ); if ( !PEAR::isError( $num_messages = $imap->getNumberOfMessages( $mailbox ) ) ){ for($i=1; $i <= $num_messages; $i++) { if (! $imap->isDeleted($i)){//ANSWER! $curMsg = $imap->getSummary($i); var_dump($curMsg); } else { echo "Or $mailbox has no messages or there was an error!\n"; } } } which, incidentally, works fine for me. I think, perhaps, this bug got fixed in the 1.1.0beta2 release (dated 2008-03-09) - maybe it should be marked as stable? ;-)
 [2009-04-03 03:43 UTC] hudeldudel (Sebastian Ebling)
-Status: Feedback +Status: Closed
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/