Magento. A seeming endless tree of files each extending and overriding another. Usually, error reporting can help you to navigate to the exact problem, but when the error is so fatal that this is not possible it makes uncovering the culprit very tedious.
This is the precise issue I had recently. The site was throwing an internal server error whenever an attempt was made to add certain products to the cart. I started with what I knew: adding to cart. I began my quest with the add to cart function. I modified the core file (only temporarily) to spit output into a temp file so that I could see if it was executing. Thus began this arduous process.
The loop was consistent. Output around each block of code to detect where it fails. If the the end of block output doesn’t write, then it the issue must be somewhere inside. Follow the function calls to any and all associated files. Repeat.
I continued this process until I found my way into Magento’s Free Shipping rules. One of the rules was causing the SKUs of every product in the database to be checked ultimately resulting in a timeout. After further inquiry, it turned out the client had recently added a rule for certain SKUs. Magento has two places that you can add rules, and apparently one of them doe not work.
After removing the rule, the problem was fixed.