How to Debug PHP code? How to debug some vague php syntax error?

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


I was getting the following error:

[Wed Feb 04 08:09:30 2009] [error] [client xxx.xxx.xxxx.xxx] PHP Parse error: syntax error, unexpected '<' in /sites/all/modules/views/views.module(542) : eval()'d code on line 1

 I wrote this code in view.module line 542 to debug:

$result = eval($view->view_args_php);

global $user;

if ($user->uid== 1){

 if ($result == FALSE){
print "ERROR CAUGHT ";
debug_print_backtrace();
exit;
}
}

 

This told me that there is a trouble with a view. I went and checked that view. There was some garbage in the argument section that had come because of FCKeditor. I corrected that and my error went away.


                                     

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 <% ... %>.