ITADN

more robust json generation

#110Pull Requestdivinity76 创建于 2023-12-29
D
divinity76commented
concatenating strings into json is... unreliable. I think the original code was written that way because definedTags and freeformTags *must* be object, not array, or be rejected as invalid, and by default json_encode makes them array, not object, the original code fixed it by writing the json manually, the new code fix it with 'definedTags' =>(object)array() - the JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE just makes the resulting json easier to read/debug by humans, if ever need be. - for example if `$displayName` is `foo"bar` then the original code would make the json `"displayName": "foo"bar",` which is a syntax error, and oci would reject the json as malformed, the new code correctly encodes it into `"displayName": "foo\"bar"` and the json remains syntactically valid
合并状态:未合并 1 条评论