From: <lei...@us...> - 2009-07-30 12:53:14
|
Author: leithoff Date: Thu Jul 30 14:52:59 2009 New Revision: 27576 URL: http://www.egroupware.org/viewvc/egroupware?rev=27576&view=rev Log: tackle problems with )( in Filenames Modified: branches/1.6/egw-pear/Net/IMAPProtocol.php Modified: branches/1.6/egw-pear/Net/IMAPProtocol.php URL: http://www.egroupware.org/viewvc/egroupware/branches/1.6/egw-pear/Net/IMAPProtocol.php?rev=27576&r1=27575&r2=27576&view=diff ============================================================================== --- branches/1.6/egw-pear/Net/IMAPProtocol.php (original) +++ branches/1.6/egw-pear/Net/IMAPProtocol.php Thu Jul 30 14:52:59 2009 @@ -2362,8 +2362,15 @@ if ($str[$pos] === $startDelim) $delimCount++; if ($str[$pos] === $stopDelim) $delimCount--; if ($str[$pos] === $stopDelim && ($str[$pos+1] === $startDelim || ($str[$pos+1] === $stopDelim && $delimCount<=0))) { - $pos--; // stopDelimited need to be parsed outside! - return false; + $numOfQuotes = substr_count($str,'"'); + $numOfMaskedQuotes = substr_count($str,'\"'); + 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"); + } else { + $pos--; // stopDelimited need to be parsed outside! + return false; + } } if ($str[$pos] === '\\') $pos++; // all escaped chars are overread (eg. \\, \", \x) $pos++; |