Saturday, May 19, 2018

Finding the results of a phpBB search that won't render

Yesterday I investigated a situation in which a phpBB forum completely failed to display the search results for a certain query, instead rendering a PHP error spew about invalid characters. I knew that the problem was that a post turned up by the search contained badly mis-encoded characters, which I would usually fix by hunting down the post in the SQL database and manually removing the bad characters, but this time my LIKE-based searching wasn't finding the post.

I happened to notice a table called phpbb_search_results. Apparently it contains recent searches and the cache key for each. I tried the problematic search then refreshed the table listing - sure enough, a row appeared. I looked for the cache key in the directory listing of /cache/production; the relevant file turned out to be data_search_results_CACHEKEY.php. The last line of that file seemed to include an array of some sort, some entries of which looked like post IDs (and a few of which I had found with my earlier database-searching attempts). Navigating to /viewtopic.php?p=POSTID for each candidate found the specific post that refused to render.

Removing garbled characters from that post made the search results page load as normal.

No comments:

Post a Comment