Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005928 [Quercus] block always 07-27-15 23:12 07-30-15 06:43
Reporter weich View Status public  
Assigned To
Priority normal Resolution open Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.36
  Product Build
Summary 0005928: serialize/unserialize unicode(CJK) string yields unkown characters sometimes.
Description I have a application runing on nginx/php5-fpm server, it can display the chines/japanese characters correctly. but after I switched to resin4.0.44 server. some page display "????" somewhere.

after long time trouble-shooting, I found there are some difference between the result generated by php5 function serialze/unserialze and the one generated by the countparts in resin4.

I guess the bug is in the class: StringBuilderValue, which get the wrong byte length when try to make a copy of a string. But I need your guys' confirmation, you are experts.

is this correct?
file : StringBuilderValue.java

  public StringBuilderValue(String s)
  {
    int len = s.length();

    _buffer = new byte[len];
    _length = len;

    for (int i = 0; i < len; i++) {
      _buffer[i] = (byte) s.charAt(i);
    }
  }


shouldn't it use "s.getBytes().length" as the following lines:

  public StringBuilderValue(String s) {
    byte[] bytes = s.getBytes();
    int len = bytes.length;

    _buffer = new byte[len];
    _length = len;

    System.arraycopy(bytes, 0, _buffer, 0, len);
}
Steps To Reproduce
Additional Information
Attached Files  api.php [^] (41 bytes) 07-30-15 06:29
 test.php [^] (1,247 bytes) 07-30-15 06:41

- Relationships

- Notes
(0006645)
weich
07-30-15 06:43

step to reproduce:
open the test.php in browser. click "&26356;&26032;"&65292; and you will see the serialized string at the page end.
 

- Issue History
Date Modified Username Field Change
07-27-15 23:12 weich New Issue
07-29-15 22:50 weich Note Added: 0006644
07-29-15 23:31 weich Note Deleted: 0006644
07-30-15 06:29 weich File Added: api.php
07-30-15 06:41 weich File Added: test.php
07-30-15 06:43 weich Note Added: 0006645


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