These are no longer needed after https://wiki.php.net/rfc/always_enable_json Closes GH-5637
It fixes bugs #66025 and #73254 by replacing globals with a passed structure holding depth and error code. In addition it fixes #72069 in a more generic way.