View Issue Details

IDProjectCategoryView StatusLast Update
0030791RunnerFunctionsPublic2020-03-09 12:26
ReporterStewart BishopAssigned ToMark Alexander 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
Product VersionInternal Build 
Target VersionFixed in VersionInternal Build 
Summary0030791: Functions: Using json_encode on a ds_map and then saving that to an ini file will make it fail on being able to read it back in
DescriptionIf you create a ds_map, json_encode it and save it out to an ini file this will be written out correctly bar the escaped quotes however upon reading it in this will fail as it'll find the first key in the json_encode and assume that's the length of your string so rather than getting the full encoded json you'll just get " { "

Attached is a very simple sample which showcases this. The only workaround seems to be going through the string and manually escaping them or replacing them temporarily.
Steps To Reproduce1) Run the sample
2) Check the output
TagsNo tags attached.
1.4 Found In
2.x Runtime Found In9.9.1.1417
2.x Runtime Verified In9.9.1.1716

Activities

Stewart Bishop

2019-04-29 17:19

Developer  

jsonIniProblem.yyz (20,122 bytes)

Russell Kay

2019-04-30 09:38

Manager   ~0063754

This is not a bug, the Ini files cannot handle certain characters (the parser is poorly specified) we have not plans to change this, we should just document that this is the case. - Fritz to follow up with what characters cannot be handled?

Mark Alexander

2019-04-30 13:37

Developer   ~0063757

Assigned on to Fritz so he can check the characters that are supported (he'll assign it back to me when that's done for documenting).

Fritz

2020-01-21 17:12

Manager   ~0065316

Hey Mark, just checked this out and the only character that I can see causing problems is " which will instantly truncate the string

So if you do:-
ini_write_string("test2", "section", "hello \"Fritz\"");

it'll truncate to "hello "

Mark Alexander

2020-01-30 10:15

Developer   ~0065331

Both ini_write_string() and json_encode() have been updated to warn of this issue. Additionally (although not part of this bug report) json_encode() docs have been updated to explain how int64 values are handled now (previously the docs said these couldn't be handled by JSON)..

Alice

2020-03-09 12:26

Adminstrator   ~0065459

Verified the change in documentation in IDE v9.2.1.2151 Runtime v9.9.1.1716.

Closing the bug. Thank you.