This script allows to bypass Oracle Cloud Infrastructure 'Out of host capacity' error immediately when additional OCI capacity will appear in your Home Region / Availability domain.
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()
$displayName
isfoo"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