{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/26353","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/26353/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/26353/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/26353/events","html_url":"https://github.com/laravel/framework/pull/26353","id":376642452,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3ODEyNzEw","number":26353,"title":"[5.7] Fix(tester): TestResponse assertExactJson does not work for empty JSON objects","user":{"login":"HongjiangHuang","id":20190812,"node_id":"MDQ6VXNlcjIwMTkwODEy","avatar_url":"https://avatars0.githubusercontent.com/u/20190812?v=4","gravatar_id":"","url":"https://api.github.com/users/HongjiangHuang","html_url":"https://github.com/HongjiangHuang","followers_url":"https://api.github.com/users/HongjiangHuang/followers","following_url":"https://api.github.com/users/HongjiangHuang/following{/other_user}","gists_url":"https://api.github.com/users/HongjiangHuang/gists{/gist_id}","starred_url":"https://api.github.com/users/HongjiangHuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HongjiangHuang/subscriptions","organizations_url":"https://api.github.com/users/HongjiangHuang/orgs","repos_url":"https://api.github.com/users/HongjiangHuang/repos","events_url":"https://api.github.com/users/HongjiangHuang/events{/privacy}","received_events_url":"https://api.github.com/users/HongjiangHuang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-02T02:17:27Z","updated_at":"2018-11-10T08:31:52Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/26353","html_url":"https://github.com/laravel/framework/pull/26353","diff_url":"https://github.com/laravel/framework/pull/26353.diff","patch_url":"https://github.com/laravel/framework/pull/26353.patch"},"body":"Solved the problems mentioned in #25960 and #25769.\r\n\r\nAfter the old decodeResponseJson directly operates on the response content json_decode($content, true), it is impossible to tell the difference between empty object and empty array.\r\n\r\n```\r\n$data = [\r\n    'a' => new class {}\r\n];\r\n\r\nvar_dump(json_encode($data)); \r\nvar_dump(json_decode(json_encode($data), true)); \r\nvar_dump(json_decode(json_encode($data)));\r\n\r\n\r\nresult: \r\n\r\nstring(8) \"{\"a\":{}}\"\r\narray(1) {\r\n  [\"a\"]=>\r\n  array(0) {\r\n  }\r\n}\r\nobject(stdClass)#4313 (1) {\r\n  [\"a\"]=>\r\n  object(stdClass)#4315 (0) {\r\n  }\r\n}\r\n```\r\nTherefore, if we want to distinguish between empty object and empty array, we need to change the second parameter $assoc to false.\r\nBut that's not compatible with the logic that preceded it. The assoc array is resolved to stdclass.\r\nSo. for compatibility, I have json_decode($data, true) and json_decode($data, false); Only get json_decode($data, false); The empty object inside is thus compatible with the previous logic, and the bug is fixed."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/437567978","html_url":"https://github.com/laravel/framework/pull/26353#issuecomment-437567978","issue_url":"https://api.github.com/repos/laravel/framework/issues/26353","id":437567978,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzU2Nzk3OA==","user":{"login":"HongjiangHuang","id":20190812,"node_id":"MDQ6VXNlcjIwMTkwODEy","avatar_url":"https://avatars0.githubusercontent.com/u/20190812?v=4","gravatar_id":"","url":"https://api.github.com/users/HongjiangHuang","html_url":"https://github.com/HongjiangHuang","followers_url":"https://api.github.com/users/HongjiangHuang/followers","following_url":"https://api.github.com/users/HongjiangHuang/following{/other_user}","gists_url":"https://api.github.com/users/HongjiangHuang/gists{/gist_id}","starred_url":"https://api.github.com/users/HongjiangHuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HongjiangHuang/subscriptions","organizations_url":"https://api.github.com/users/HongjiangHuang/orgs","repos_url":"https://api.github.com/users/HongjiangHuang/repos","events_url":"https://api.github.com/users/HongjiangHuang/events{/privacy}","received_events_url":"https://api.github.com/users/HongjiangHuang/received_events","type":"User","site_admin":false},"created_at":"2018-11-10T08:31:52Z","updated_at":"2018-11-10T08:31:52Z","author_association":"CONTRIBUTOR","body":"poke @taylorotwell "}}
{"actor":{"display_login":"HongjiangHuang"}}