How to debug in Drupal using drupal_set_message and come to the exact line that is causing the error?

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


Put the following code snippet in includes/bootstrap.inc in the drupal_set_message function.. .

<code>
 if ($type == 'error') {
    $message .= '<pre>'. print_r(debug_backtrace(), 1) .'</pre>';
  }
</code>

                                     

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.