[imp] Folder names with tilde character

Jan Schneider jan at horde.org
Thu Nov 19 21:28:35 UTC 2015


Zitat von Michael M Slusarz <slusarz at horde.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>
>>> Quoting Jens Wahnes <wahnes at uni-koeln.de>:
>>>
>>>> After a very long search, I found out that this problem is caused  
>>>> by the code in the Horde_Imap_Client_Tokenize class, or more  
>>>> precisely the code within the "next" method on line 292 or so.   
>>>> There is a comment attached to the "case" statement in question  
>>>> which reads "Ignore binary string identifier. PHP strings are  
>>>> binary-safe", but even after reading quite a bit of the  
>>>> surrounding code, I fail to understand what is meant by that  
>>>> comment.
>>>
>>> It means that PHP doesn't care if a string contains NULLs, so we  
>>> are just discarding the ~ when it is part of the literal8  
>>> construction (since a NULL is treated as a single-byte character  
>>> for PHP string processing).
>>>
>>> RFC 6855 support is irrelevant here - literal8 is defined by  
>>> BINARY so this can be tested on a server that supports BINARY.   
>>> Thus, if you have a fix Jan you don't need access to a UTF-8  
>>> server to properly test.
>>
>> Okay, and when is BINARY used, so I have a use case where ~ *does*  
>> indicate binary strings? Any binary attachment?
>>
> The only place where we would need to *parse* a literal8, is when  
> reading BODY data of a part.  I think we always try to do this, but  
> IIRC the server only has to send literal8 when the data both 1) is  
> 8bit an 2) contains NULs.  So you would have to artificially create  
> that kind of data to possibly receive the correct response.
>
> Regardless, UTF8 support isn't useful for testing since it only  
> defines literal8 for sending data in APPENDS (thus, no local parsing  
> needed).
>
> It's going to be much easier to write a unit test for this.  I'm  
> almost 100% positive there's a unit test dedicated to tokenization  
> of server response strings.  So test that these two strings are  
> parsed correctly:
>
> * 1 FETCH (BINARY[1] ~{1}
> and
> * LIST () "" "~foo"
>
> michael

http://github.com/horde/horde/commit/2cc3963358d08fe180db41a0bdeb2b7844bf47ac

-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the imp mailing list