solution for UIDs bigger than 2^31

Michal Hlavinka <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
Hi,

we're trying to fix squirrelmail's problem with UIDs bigger than 2^31.

(sf#1855717 , rhbz#450780, ...)

in short:
IMAP server uses UIDs to identify emails which are 32 bit values. Some 
servers use lower values, but for example dovecot can gets to really 
high values.

Squirrelmail handles these UIDs like integers, but PHP (on 32-bit 
system) has only 32 bit signed integer, so only first 31 bits are 
usable. If UID is bigger, squirrelmail can't communicate about this 
email with imap server.


solution:
In sf tracker (no change for 10 months) is recommended to "cast" input 
values to strings and change them to zero if input value is not numeric. 
I was finishing patch for this, but I've found squirrelmail uses also 
++, -- and comparison operators for UIDs (in 
plugins/delete_move_next/setup.php: 152: delete_move_next_read(...) 
function). So strings can't be used for this.

There is maybe another solution. Use not integers but floats.
http://www.php.net/float says : "The size of a float is 
platform-dependent, although a maximum of ~1.8e308 with a precision of 
roughly 14 decimal digits is a common value (the 64 bit IEEE format)." I 
can confirm that php keeps number without exponent exactly up to 14 
digits (tested on i386, x86_64 and ppc64). For 32 bit values 10 digits 
are needed. Also we have one squirrelmail instance running with floats 
instead of ints and it's running fine (of course, I can't say all 
possible function combination was tested).

What do you think about this? Or, do you think, there is another solution?

Cheers,
Michal


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.