One of the most annoying features in Drupal, which i think is a design flaw, is allowing the developer to add PHP node inside the body on a node or block.
It can make your life so much more difficult in certain cases when you have to debug something.
You may think that the code you write will never fail, or that you are not one of those developers that can break the site and just see a white page because of their code.
Usually when you override a theme and something goes wrong you just see the logs and you can see a clear stack of where the problem is and locate the appropriate file.
That is not the case when your code inside a node fails or even better when it fails inside a block. The stack of the error in the logs can lead you nowhere, usually inside some core module file that means nothing to you and just evals some variable. To make things worse, if your Drupal site is broken and you see just a white screen, then you have no alternative than to dig up the problematic code directly from your database and fix it there!
Recently i have been in such a situation during a migration of a perfectly operating site. Unfortunately due to different php versions and certain php legacy options turned off the site broke.
To make your life easier i will document here where you can look up for your php code in the database.
Here we go:
SELECT * FROM field_revision_body WHERE body_format='php_code';
SELECT * FROM block_custom WHERE FORMAT='php_code';
SELECT * FROM locales_source s LEFT JOIN locales_target t ON s.lid=t.lid
WHERE s.source LIKE '%<?php%' OR t.translation LIKE '%<?php%';
So as you can see the places where i found php code is inside the node body, the revisions’ node body, in blocks and also in some translations of blocks’ body.
That’s all for now.