Debugging
When custom fields are injected by means of execution enzymes, their PHP code gets evaluated from inside a method that takes care of the return value, the errors and the output. Before the evaluation, as many arguments as specified by an enzyme are popped from the internal stack and put into the ´$arguments´ array. After the evaluation, the return value is pushed onto the internal stack; errors and output are sent to the JavaScript console.
Tip. While developing an execution enzyme, frequently check the JavaScript console. There are in fact two kinds of PHP errors: Shutdown errors and non-shutdown errors. The former are easy to detect because they make the PHP interpreter stop at the point they occur and very often the resulting output is awfully broken. The latter instead make the PHP interpreter try to recover. Nzymes takes care of both types and tries to output to the JavaScript console as much information as possible to help you debug your code.
Syntax Error Example.
Above, a PHP Parse error is captured by Nzymes and shown into the JavaScript console. Notice that the page is not broken.
Fatal Error Example.
Above, a PHP Fatal error is captured by Nzymes and shown into the JavaScript console. Notice that the page is broken.
You could want to install the Debug Bar Console plugin for WordPress. It allows you to rapidly try out PHP snippets from your blog admin, having at your disposal all of your blog environment.
|
|
Nzymes | WordPress Plugin |
© 2015 by Andrea Ercolino |