Opened 12 years ago
Closed 12 years ago
#543 closed defect (fixed)
xml2json.php should not include a semi-colon at the end
Reported by: | jng | Owned by: | jng |
---|---|---|---|
Priority: | P2 | Milestone: | Future |
Component: | Widgets | Version: | 2.0 |
Severity: | Major | Keywords: | |
Cc: | Browser: | All | |
External ID: | Operating System: | All | |
state: | New |
Description
The switch to using JSON.parse over eval breaks on content returned by XML2JSON.php because it inserts a semi-colon at the end of the JSON literal (presumably to be eval()'d client-side). Since we don't eval() such content anymore (except for browsers that don't support a native JSON object), we should not be appending this semi-colon anymore.
To preserve existing behaviour for browsers where eval() is still used, it should check if the JSON string ends with a semi-colon, and append one if required before eval()-ing the string. Still this is a stop-gap measure until a JSON.parse() replacement is found for these browsers.