try to work around the php5.3.7+8 is_a bug/feature, approach with instanceof only

This commit is contained in:
Klaus Leithoff 2011-11-11 08:34:48 +00:00
parent 2b0dc8e68f
commit 971688e629

View File

@ -316,8 +316,8 @@ class Net_IMAPProtocol {
*/ */
function _recvLn() function _recvLn()
{ {
$this->lastline = $this->_socket->gets( 8192 );
if (PEAR::isError( $this->lastline = $this->_socket->gets( 8192 ) ) ) { if ( $this->lastline instanceof PEAR_Error ) {
return new PEAR_Error('Failed to write to socket: ' . return new PEAR_Error('Failed to write to socket: ' .
$this->lastline->getMessage() ); $this->lastline->getMessage() );
} }
@ -378,7 +378,8 @@ class Net_IMAPProtocol {
function _getRawResponse($commandId = '*') function _getRawResponse($commandId = '*')
{ {
$arguments = ''; $arguments = '';
while ( !PEAR::isError( $this->_recvLn() ) ) { while ( $a = $this->_recvLn() ) {
if ($a instanceof PEAR_Error) return $arguments;
$reply_code = strtok( $this->lastline , ' ' ); $reply_code = strtok( $this->lastline , ' ' );
$arguments.= $this->lastline; $arguments.= $this->lastline;
if ( !(strcmp( $commandId , $reply_code ) ) ) { if ( !(strcmp( $commandId , $reply_code ) ) ) {
@ -2445,7 +2446,7 @@ class Net_IMAPProtocol {
if ((($numOfQuotes - $numOfMaskedQuotes) % 2 ) == 0) { if ((($numOfQuotes - $numOfMaskedQuotes) % 2 ) == 0) {
// quotes are balanced, so its unlikely that we meet a stop condition here as strings may contain )( // 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__. "->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; //return false;
} else { } else {
$pos--; // stopDelimited need to be parsed outside! $pos--; // stopDelimited need to be parsed outside!