| Anonymous | Login | Signup for a new account | 10-31-2025 06:58 PDT | 
| Main | My View | View Issues | Change Log | Docs | 
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0003296 | [Quercus] | minor | always | 01-24-09 16:36 | 01-26-09 12:14 | ||||
| Reporter | koreth | View Status | public | ||||||
| Assigned To | nam | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | 4.0.0 | ||||||
| Summary | 0003296: preg_replace throws exception on malformed UTF-8 when "u" modifier is used | ||||||||
| Description | <?php $bad_utf8 = "abc\xf0"; print strlen(preg_replace("/[^\pL]/u", "", $bad_utf8)); Regular PHP prints "0" (the preg_replace returns an empty string). Quercus throws an exception: com.caucho.quercus.QuercusRuntimeException: bad UTF-8 sequence, saw EOF at com.caucho.quercus.lib.regexp.Regexp.fromUtf8(Regexp.java:267) at com.caucho.quercus.lib.regexp.Regexp.convertSubject(Regexp.java:182) at com.caucho.quercus.lib.regexp.RegexpState.<init>(RegexpState.java:79) at com.caucho.quercus.lib.regexp.CauchoRegexpModule.pregReplaceString(CauchoRegexpModule.java:769) at com.caucho.quercus.lib.regexp.CauchoRegexpModule.pregReplace(CauchoRegexpModule.java:678) at com.caucho.quercus.lib.regexp.CauchoRegexpModule.preg_replace(CauchoRegexpModule.java:614) at com.caucho.quercus.lib.regexp.RegexpModule.preg_replace(RegexpModule.java:175) Workaround is to sanitize the input before calling preg_replace. | ||||||||
| Additional Information | |||||||||
| Attached Files | |||||||||
|  | |||||||||
| Mantis 1.0.0rc3[^]
	Copyright © 2000 - 2005 Mantis Group
	29 total queries executed. 26 unique queries executed. |