try to work around the php5.3.7+8 is_a bug/feature

This commit is contained in:
Klaus Leithoff 2011-11-10 17:07:01 +00:00
parent 145dcc6d02
commit 2b3211b13d

View File

@ -317,7 +317,9 @@ class Net_IMAPProtocol {
function _recvLn()
{
if (PEAR::isError( $this->lastline = $this->_socket->gets( 8192 ) ) ) {
//if (PEAR::isError( $this->lastline = $this->_socket->gets( 8192 ) ) ) {
$this->lastline = $this->_socket->gets( 8192 );
if (!(is_string($this->lastline) || is_numeric($this->lastline)) && ( $this->lastline instanceof PEAR_Error) ) {
return new PEAR_Error('Failed to write to socket: ' .
$this->lastline->getMessage() );
}
@ -378,7 +380,8 @@ class Net_IMAPProtocol {
function _getRawResponse($commandId = '*')
{
$arguments = '';
while ( !PEAR::isError( $this->_recvLn() ) ) {
while ( $a = $this->_recvLn() ) {
if (!(is_string($a) || is_numeric($a)) && ($a instanceof PEAR_Error)) return $arguments;
$reply_code = strtok( $this->lastline , ' ' );
$arguments.= $this->lastline;
if ( !(strcmp( $commandId , $reply_code ) ) ) {
@ -2447,7 +2450,7 @@ class Net_IMAPProtocol {
if ((($numOfQuotes - $numOfMaskedQuotes) % 2 ) == 0) {
// quotes are balanced, so its unlikely that we meet a stop condition here as strings may contain )(
//error_log(__METHOD__. "->Length: $len; NumOfQuotes: $numOfQuotes - NumofMaskedQuotes:$numOfMaskedQuotes #".$str."\n");
error_log(__METHOD__." problem at $pos with:".$str[$pos]."(last character) Numberof delimiters ('".$startDelim."','".$stopDelim."') found:".$delimCount.' String:'.substr($str,$startingpos,$pos).' called from:'.function_backtrace());
if ($_debug) error_log(__METHOD__." problem at $pos with:".$str[$pos]."(last character) Numberof delimiters ('".$startDelim."','".$stopDelim."') found:".$delimCount.' String:'.substr($str,$startingpos,$pos).' called from:'.function_backtrace());
//return false;
} else {
$pos--; // stopDelimited need to be parsed outside!