Part 4: Power Coders

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.

Screen Shot 2015-02-16 at 17.35.41

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.

Screen Shot 2015-02-16 at 18.01.16

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.