WordPress Plugin Repository Checks For PHP Errors

Just before Christmas a notice was sent out to all plugin authors on WordPress.org.

As of now, when a plugin author tries to commit the plugin files to the WordPress plugin repository using SVN the PHP code will be rejected if any syntax errors are found.

The plugin author will receive an email telling them the reason for the rejection and the line number(s) where the error was found.

An example of what happens when an error is found was given:

Error: Commit failed (details follow):
Error: Commit blocked by pre-commit hook (exit code 1) with output:
Error: PHP Parse error: syntax error, unexpected end of file in - on line 1234
Error:
Error: ***********************************
Error: PHP error in: really-cool/tags/1.0/really-cool.php:
Error: Errors parsing really-cool/tags/1.0/really-cool.php
Error: ***********************************
Error: This error was generated by a custom hook script on the Subversion server.
Error: Please contact your server administrator for help with resolving this issue.
Completed!:

I think this is a great idea as it helps protect the end users from being disappointed after downloading, activating and seeing a “PHP Fatal Error” message (or worse) appearing on the website.

It also acts as a check for the developers too, not all of whom may be seasoned coders.

Andrew Nacin chipped in with a comment that the syntax checking is performed against PHP 5.4 and further asked developers to be careful when adding 5.3 and 5.4 specific language features which may “break” sites running on PHP 5.2 and below.

Hopefully this new feature will help to ensure end users have a more reliable WordPress experience and help to further expand its growth on the interwebs.

Was this article helpful?
YesNo