Details
Description
On the constructor the class variable "$this->_bigEndian" is hardcoded with a "1" value, on 64 Bits processors this convert the float values incorrectly because the method "writeDouble" execute a strrev($stream), with that all the float values are displayed as 0.40998789798-E123 for example
I detected that on the constructor is the following sentence:
$testEndian = unpack("C*", pack("S*", 256));
and following is: $this->_bigEndian = 1;
that I believe that the intention is to detect the endian on the server but it was never used
I changed the line with $this->_bigEndian = 1;
to
$this->_bigEndian = $testEndian[2];
Please verify if the solution is correct, I tested on my both environments:
My Linux box running: Apache/2.0.59 (Unix) DAV/2 PHP/5.2.6
My Solaris Box 64bits: Apache/2.0.59 (Unix) PHP/5.2.9
Let me know if you need more details and If I can help documenting this
I don't know how your change will work correctly because on readDouble the byte order wasn't tested before reverting the stream.
Additionally this will set bigEndian to 1 on little endian systems.