| Anonymous | Login | Signup for a new account | 11-10-2025 00:56 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0003189 | [Quercus] | minor | always | 12-17-08 23:45 | 12-18-08 09:35 | ||||
| Reporter | koreth | View Status | public | ||||||
| Assigned To | nam | ||||||||
| Priority | normal | Resolution | fixed | Platform | |||||
| Status | closed | OS | |||||||
| Projection | none | OS Version | |||||||
| ETA | none | Fixed in Version | 4.0.0 | Product Version | 4.0.0 | ||||
| Product Build | |||||||||
| Summary | 0003189: json_decode fails on primitive values | ||||||||
| Description |
<?php print_r(json_decode('5')); Regular PHP prints "5". Quercus prints "Warning: error parsing '5': expected no more input [json_decode]". The following patch seems to match PHP's behavior (though it doesn't detect numeric values, which may or may not be worth doing): --- a/modules/quercus/src/com/caucho/quercus/lib/json/JsonDecoder.java +++ b/modules/quercus/src/com/caucho/quercus/lib/json/JsonDecoder.java @@ -51,6 +51,12 @@ class JsonDecoder { _isAssociative = assoc; + int c = skipWhitespace(); + if (c != '[' && c != '{' && c != '"') { + return s; + } + unread(); + Value val = jsonDecodeImpl(env); // Should now be at end of string or have only white spaces left. |
||||||||
| Steps To Reproduce | |||||||||
| Additional Information | |||||||||
| Attached Files | |||||||||
|
|
|||||||||
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |