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

Submitted by programmer on Wed, 02/04/2009 - 13:25.
::

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 your Answer

  • Lines and paragraphs break automatically.
  • 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 <% ... %>.

More information about formatting options