Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

more robust json generation#110

Open
divinity76 wants to merge 2 commits into
hitrov:mainfrom
divinity76:patch-1
Open

more robust json generation#110
divinity76 wants to merge 2 commits into
hitrov:mainfrom
divinity76:patch-1

Conversation

@divinity76

@divinity76 divinity76 commented Dec 29, 2023

Copy link
Copy Markdown

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

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()
@divinity76

divinity76 commented Jan 1, 2024

Copy link
Copy Markdown
Author

this patch is now confirmed to work :D i just got my server yesterday with this patch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants