{"action":"created","issue":{"url":"https://api.github.com/repos/10up/ElasticPress/issues/1062","repository_url":"https://api.github.com/repos/10up/ElasticPress","labels_url":"https://api.github.com/repos/10up/ElasticPress/issues/1062/labels{/name}","comments_url":"https://api.github.com/repos/10up/ElasticPress/issues/1062/comments","events_url":"https://api.github.com/repos/10up/ElasticPress/issues/1062/events","html_url":"https://github.com/10up/ElasticPress/pull/1062","id":316704600,"number":1062,"title":"Ensure that element exists before accessing it.","user":{"login":"dotancohen","id":246144,"avatar_url":"https://avatars3.githubusercontent.com/u/246144?v=4","gravatar_id":"","url":"https://api.github.com/users/dotancohen","html_url":"https://github.com/dotancohen","followers_url":"https://api.github.com/users/dotancohen/followers","following_url":"https://api.github.com/users/dotancohen/following{/other_user}","gists_url":"https://api.github.com/users/dotancohen/gists{/gist_id}","starred_url":"https://api.github.com/users/dotancohen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotancohen/subscriptions","organizations_url":"https://api.github.com/users/dotancohen/orgs","repos_url":"https://api.github.com/users/dotancohen/repos","events_url":"https://api.github.com/users/dotancohen/events{/privacy}","received_events_url":"https://api.github.com/users/dotancohen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-23T08:09:14Z","updated_at":"2018-05-22T08:59:02Z","closed_at":"2018-05-22T08:59:02Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/10up/ElasticPress/pulls/1062","html_url":"https://github.com/10up/ElasticPress/pull/1062","diff_url":"https://github.com/10up/ElasticPress/pull/1062.diff","patch_url":"https://github.com/10up/ElasticPress/pull/1062.patch"},"body":"This patch ensures that the aggregation exists before attempting to access it. In my case, we call the aggregations something other than `terms` so the code below was throwing errors.\r\n\r\nNote that a better fix would be to iterate over all aggregations and store them separately, however that would require also changing the places which read from `$GLOBALS['ep_facet_aggs']`."},"comment":{"url":"https://api.github.com/repos/10up/ElasticPress/issues/comments/390915843","html_url":"https://github.com/10up/ElasticPress/pull/1062#issuecomment-390915843","issue_url":"https://api.github.com/repos/10up/ElasticPress/issues/1062","id":390915843,"user":{"login":"dotancohen","id":246144,"avatar_url":"https://avatars3.githubusercontent.com/u/246144?v=4","gravatar_id":"","url":"https://api.github.com/users/dotancohen","html_url":"https://github.com/dotancohen","followers_url":"https://api.github.com/users/dotancohen/followers","following_url":"https://api.github.com/users/dotancohen/following{/other_user}","gists_url":"https://api.github.com/users/dotancohen/gists{/gist_id}","starred_url":"https://api.github.com/users/dotancohen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotancohen/subscriptions","organizations_url":"https://api.github.com/users/dotancohen/orgs","repos_url":"https://api.github.com/users/dotancohen/repos","events_url":"https://api.github.com/users/dotancohen/events{/privacy}","received_events_url":"https://api.github.com/users/dotancohen/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T08:59:02Z","updated_at":"2018-05-22T08:59:02Z","author_association":"CONTRIBUTOR","body":"There is no need to check `$response['aggregations'] )` first. `empty()` is a language construct, not a function, and is safe to use on undefined elements. Otherwise even `empty( $response['aggregations']['terms'] )` would not be safe!"}}
{"actor":{"display_login":"dotancohen"}}