{"issue":{"created_at":"2011-08-25T22:11:21Z","state":"closed","updated_at":"2011-11-30T21:25:34Z","comments":4,"user":{"gravatar_id":"a758a3961af22e35e7173df8e513285c","id":281947,"url":"https://api.github.com/users/Ricjustsaid","avatar_url":"https://secure.gravatar.com/avatar/a758a3961af22e35e7173df8e513285c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"Ricjustsaid"},"body":"My error log has been filling up with these PHP warnings from SimpleSearch. It seems that it's possible for the offset passed to strpos() to be greater than the actual length of the extract, causing PHP to throw this warning. It doesn't affect the search results, but it can fill up the error log on busy sites.\r\n\r\nProposed fix:\r\n\r\nAdd this code above line 314 of simplesearch.class.php (at the start of the else{} condition):\r\n\r\n                    $pos_end = 0;\r\n                \r\n                    if( strlen( $text ) >= $length - 1 ) {\r\n                        $pos_end = min(strpos($text, ' ', $length - 1), strpos($text, '.', $length - 1));\r\n                    }\r\n\r\nIt simply checks to make sure that the offset is not greater than the length of the extract text.","assignee":null,"id":1486508,"number":55,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[{"name":"Bug","color":"8a5f5f","url":"https://api.github.com/repos/splittingred/SimpleSearch/labels/Bug"}],"title":"PHP warning: strpos(): Offset not contained in string","html_url":"https://github.com/splittingred/SimpleSearch/issues/55","closed_at":"2011-11-30T21:25:34Z","url":"https://api.github.com/repos/splittingred/SimpleSearch/issues/55","milestone":null},"action":"closed"}