Re: Fix for bug #63437

From: Date: Mon, 11 Mar 2013 11:42:44 +0000
Subject: Re: Fix for bug #63437
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-66583@lists.php.net to get a copy of this message
Please, no top posting! On Mon, 11 Mar 2013, Anatol Belski wrote: > On Sun, March 10, 2013 23:11, Derick Rethans wrote: > > On Sat, 9 Mar 2013, Anatol Belski wrote: > > > >> On Sat, 2013-03-09 at 21:57 +0100, Gustavo Lopes wrote: > >> > >>> I would agree in principle, but, as I explained before, there is a > >>> problem. The DatePeriod class has 64-bit integers in its internal > >>> structure. The PHP integer type cannot (in general) represent that > >>> data. So the general method of getting the object data via > >>> get_properties and serializing (and then using __set_state to > >>> convert the array back) does not work unless you represent those > >>> 64-bit integers with some non-integer type and do the conversions. > >> > >> So base64 seems to be only the doubtful point. Thriving to fix > >> that, what if we could bring it in dependency of libgmp to > >> serialize and read as strings (and maybe disable serialization > >> otherwise)? > > > > Why do you need libgmp for that‽ > libgmp was just the first shot as it has functions to convert from > arbitrary binary data to string and vice versa, mpz_import and > mpz_export. That's what should work fine across platforms. Looking at > the type definitions here > > http://lxr.php.net/xref/PHP_5_5/ext/date/lib/timelib_structs.h#70 i > wouldn't exclude possible platform issues. Implementing that manually > is a tricky job, could be done probably with more homework :) > > What is the way you had in the mind to achieve the string<->integer > conversions? atoll() (or atoq()). cheers, Derick

« previous php.internals (#66583) next »