I added a custom block that uses PHP, and now I get the following notice message:

Trying to get property of non-object in eval() (line 5 of /public_html/modules/php/php.module(80) : eval()'d code).

I am trying to find which one is causing that notice, and since I have many blocks, I would rather do it without using the user interface.

Is there a way to get a list of blocks using PHP? I would be happy also with a solution using the Views module, as long as I don't need to look at the settings of each block, one by one.


1 Answer 1


If you want to find all custom blocks that have PHP code as their input format, you can query the block_custom table. The format column will contain the key php_code.

$blocks = db_select('block_custom')
  ->condition('format', 'php_code')
foreach($blocks as $block) {
  // @TODO: Add your own actionable code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.