{"action":"created","issue":{"url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/24","labels_url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/24/comments","events_url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/24/events","html_url":"https://github.com/g4b0/silverstripe-searchable-dataobjects/pull/24","id":110266457,"number":24,"title":"Prevent PHP Strict Notice in CustomSearch::getSearchResults()","user":{"login":"HARVS1789UK","id":5114645,"avatar_url":"https://avatars.githubusercontent.com/u/5114645?v=3","gravatar_id":"","url":"https://api.github.com/users/HARVS1789UK","html_url":"https://github.com/HARVS1789UK","followers_url":"https://api.github.com/users/HARVS1789UK/followers","following_url":"https://api.github.com/users/HARVS1789UK/following{/other_user}","gists_url":"https://api.github.com/users/HARVS1789UK/gists{/gist_id}","starred_url":"https://api.github.com/users/HARVS1789UK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HARVS1789UK/subscriptions","organizations_url":"https://api.github.com/users/HARVS1789UK/orgs","repos_url":"https://api.github.com/users/HARVS1789UK/repos","events_url":"https://api.github.com/users/HARVS1789UK/events{/privacy}","received_events_url":"https://api.github.com/users/HARVS1789UK/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-07T16:35:41Z","updated_at":"2015-10-08T11:09:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/pulls/24","html_url":"https://github.com/g4b0/silverstripe-searchable-dataobjects/pull/24","diff_url":"https://github.com/g4b0/silverstripe-searchable-dataobjects/pull/24.diff","patch_url":"https://github.com/g4b0/silverstripe-searchable-dataobjects/pull/24.patch"},"body":"Prevent PHP Strict Notice when DataObject::get_by_id() fails to return a valid DataObject in CustomSearch::getSearchResults().\r\n\r\nCustomSearch::getSearchResults() previously assumed that all rows of the SearchableDataObjects DB table will successfully return a valid DataObject when executing the following:\r\n\r\n```$do = DataObject::get_by_id($row['ClassName'], $row['ID']);```\r\n\r\nThere are scenarios when this will return false (meaning $do contains the value of false) and then the following two lines will throw a PHP Strict Notice (as you cannot use the ->property syntax on a variable which contains anything but an object and false !== an object):\r\n\r\n![screen shot 2015-10-07 at 17 28 56](https://cloud.githubusercontent.com/assets/5114645/10344052/1bb9e1d6-6d19-11e5-88c3-d505a6f9b086.png)\r\n\r\nI identified this issue as I had upgraded my SS blog module to a newer version where the BlogEntry class was replaced with BlogPost. My database therefore contained a number of outdated values for the DB's SiteTree table ClassName fields (which read BlogEntry instead of BlogPost). This in turn meant my SearchableDataObjects DB table was full of rows containing ClassName values of BlogEntry.\r\n\r\nThis meant numerous calls to ``` DataObject::get_by_id(\"BlogEntry\", 123);``` which returns false, presumably because the BlogEntry class no longer exists in the code base.\r\n\r\nI expect there will be other instances where peoples databases will contain outdated, inaccurate data and this will end up in the SearchableDataObjects table, causing the same issue.\r\n"},"comment":{"url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/comments/146506334","html_url":"https://github.com/g4b0/silverstripe-searchable-dataobjects/pull/24#issuecomment-146506334","issue_url":"https://api.github.com/repos/g4b0/silverstripe-searchable-dataobjects/issues/24","id":146506334,"user":{"login":"HARVS1789UK","id":5114645,"avatar_url":"https://avatars.githubusercontent.com/u/5114645?v=3","gravatar_id":"","url":"https://api.github.com/users/HARVS1789UK","html_url":"https://github.com/HARVS1789UK","followers_url":"https://api.github.com/users/HARVS1789UK/followers","following_url":"https://api.github.com/users/HARVS1789UK/following{/other_user}","gists_url":"https://api.github.com/users/HARVS1789UK/gists{/gist_id}","starred_url":"https://api.github.com/users/HARVS1789UK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HARVS1789UK/subscriptions","organizations_url":"https://api.github.com/users/HARVS1789UK/orgs","repos_url":"https://api.github.com/users/HARVS1789UK/repos","events_url":"https://api.github.com/users/HARVS1789UK/events{/privacy}","received_events_url":"https://api.github.com/users/HARVS1789UK/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T11:09:42Z","updated_at":"2015-10-08T11:09:42Z","body":"@g4b0 I have done so now in commit 24c6e1e8a2de5a8afb44e0c46bdc422748f8585b"}}