Fast Plugin Error Detection
by
05 Jun 2006
So you have a lot of plugins, you don't know exactly what code runs in each of them, and your showthread suddenly starts spewing errors in eval()'d code.
Disabling hooks in general fixed it, so you are certain it's a hack. But which one? You now face the long task of disabling possibly 50+ products in order to see which one it is. Even by looking at hook locations, there could be any number of products.
That's where this tutorial comes in the picture. Follow these steps and you will be able to locate what product it is within minutes.- Examine the error message
Here's an example error message that Robert in IRC had yesterday:
Code:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /includes/class_postbit.php(279)
Okay, this tells you a number of things, marked in italics and underline.
It tells you what file the hook is located, and also where in the file the hook is located.
This enables us to move on to step 2.
- Determine the hook name
This is the part where we open up /includes/class_postbit.php and go to line 279, and discover the hook name is postbit_display_complete.
Based on this information and the one we found in Step #1, we can now move on to the next step.
- Query for the product
Run the following query either in the AdminCP or in phpMyAdmin:
Code:
SELECT plugin.hookname, plugin.title, plugin.product, product.title
FROM TABLEPREFIXplugin AS plugin
LEFT JOIN TABLEPREFIXproduct AS product ON(product.productid = plugin.product)
WHERE `hookname` = 'postbit_display_complete'
AND phpcode LIKE '%array_merge(%'
Replace TABLEPREFIX with your actual table prefix.
What you are doing here is taking a small bit of the error message, the relevant bit ("array_merge") and searching for it in all the plugins that appear in the hook called in the line you saw in the error in step #1.
This will turn up a nice set of results: The hook name, and plugin/product titles.
You should then move on to the support thread of the hack in question, and look for a fix. If none exists, post a post with the result of the query and the hack author will fix it as soon as possible.
The italics/underlined parts are the parts that will vary from error to error. You must "replace" them with the error you are recieving in order for it to "work" for you.
|