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 see that the patch was committed to trunk but there was no test case commit to trunk. Do you plan on committing a test?

Posted by Wade Arnold (wadearnold) on 2010-01-17T11:25:43.000+0000

Also thanks for the patch!!!

Posted by Wade Arnold (wadearnold) on 2010-01-17T11:30:43.000+0000

I have run AllTests with this patch on 64 and 32 bit system and everything passes. We should really add a patch for when it would fail so that people know to upgrade. I am going to promote the change to the next release.