Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002119 [Quercus] minor always 10-26-07 20:01 10-01-07 14:12
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.3
Summary 0002119: Binary values get altered when concatenated to a string
Description test/TestBinary.java:

package test;
import com.caucho.quercus.env.*;
class TestBinary {
        public static BinaryValue doTest() {
                byte[] testArray = new byte[1];
                testArray[0] = (byte)0x9c;
                return new BinaryBuilderValue(testArray);
        }
}

test.php:
<?php
import test.TestBinary;

$var = TestBinary::doTest();
$fp = fopen("/tmp/x", "w");
fwrite($fp, $var);
fwrite($fp, "x" . $var);
fclose($fp);

If you examine /tmp/x, you will see that the first fwrite() wrote the binary value, 0x9c. Then there's an "x" (0x78). Then, instead of another 0x9c, you'll see 0xfa.

If you change the $var assignment to "$var = chr(156);" then you get the correct output; this only seems to manifest with binary values returned by Java code (it bit me in some custom serialization code.)

Now that I've identified the problem I can work around it but it certainly seems like a bug.
Additional Information
Attached Files

- Relationships

- Notes
(0002406)
ferg
10-01-07 14:12

php/0jdf
 

- Issue History
Date Modified Username Field Change
10-26-07 20:01 koreth New Issue
10-01-07 14:12 ferg Note Added: 0002406
10-01-07 14:12 ferg Assigned To  => ferg
10-01-07 14:12 ferg Status new => closed
10-01-07 14:12 ferg Resolution open => fixed
10-01-07 14:12 ferg Fixed in Version  => 3.1.4


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker