Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
3395 | major | always | 03-17-09 05:01 | 03-19-09 02:31 | |
|
|||||
Reporter: | tlandmann | Platform: | |||
Assigned To: | OS: | ||||
Priority: | normal | OS Version: | |||
Status: | new | Product Version: | 3.2.1 | ||
Product Build: | Resolution: | open | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | |||
|
|||||
Summary: | 0003395: substr() function returns wrong results and even breaks the whole script for certain utf-8 strings | ||||
Description: |
Please note the attached script (in order to safely preserve its UTF-8 encoding, I decided to send it as a .zip file instead of plain .php). This is the content of the script: --------------------- <?php header("Content-Type: text/plain; charset=utf-8"); $str="&0001724;&8541;&8542;&0001592;&0001758;"; echo "2 characters starting from 1 from '$str': ".substr($str, 1, 2); echo "\n\n\n"; if (isset($_REQUEST['2nd']) && $_REQUEST['2nd']=="true") { echo "2 characters starting from 0 from '$str': ".substr($str, 0, 2); } echo "\n\n"; ?> --------------------- If called with the following URL: http://<domain_and_path>/exmpl4_quercus_bug.php [^] , it produces the following output: --------------------- 2 characters starting from 1 from '&0001724;&8541;&8542;&0001592;&0001758;': &8541;&8542; --------------------- This output is also seen in Screenshot 1 (i'll upload that later). It is obviously wrong, because the two characters were extracted in the wrong order. This still looks like a minor bug. However, if I call the script as: http://<domain_and_path>/exmpl4_quercus_bug.php?2nd=true [^] , it produces the following output: --------------------- 2 characters starting from 1 from '&0001724;&8541;&8542;&0001592;&0001758;': &8541;&8542; 2 characters starting from 0 from '&0001724;&8541;&8542;&0001592;&0001758;': &0001724;&8541; --------------------- This means that apart from not extracting the requested substrings and not handling the single quotes properly, the call even breaks the descriptive string "constant" before the substr() call. I played with this a little and found out that Quercus' behaviour is very weird. I didn't manage to find out any rules by which this happens. By the way: I verified that the problem is NOT a browser or operating specific issue (tried Mozilla on Windows and Ubuntu as well as IE on Windows - each time the problem was all the same). |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
exmpl4_quercus_bug.zip [^] (362 bytes) 03-17-09 05:01 screen1.PNG [^] (42,497 bytes) 03-17-09 05:01 screen2.PNG [^] (44,526 bytes) 03-17-09 05:02 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|