Title: Known issues with pre-commit to the plugins SVN
Author: Samuel Wood (Otto)
Published: July 14, 2016
Last modified: November 8, 2016

---

 [  ](https://profiles.wordpress.org/otto42/) [Samuel Wood (Otto)](https://profiles.wordpress.org/otto42/)
9:36 pm _on_ July 14, 2016      

# Known issues with pre-commit to the plugins SVN

Have you seen this recently?

`
 $ svn ci -m 'commit first version of plugin' Adding trunk/readme.txt Adding trunk/
my-cool-plugin.php Transmitting file data .......svn: E165001: Commit failed (details
follow): svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:

***********************************
 PHPPHP PHP (recursive acronym for PHP: Hypertext
Preprocessor) is a widely-used open source general-purpose scripting language that
is especially suited for web development and can be embedded into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)
error in: my-cool-pluginPlugin A plugin is a piece of software containing a group
of functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party./my-cool-plugin.php: Errors parsing
my-cool-plugin/my-cool-plugin.php ***********************************

A couple weeks ago, the PHP “lint” part of the SVNSVN Short for "SubVersioN", it's
the code management system used to maintain the plugins hosted on WordPress.org.
It's similar to git. pre-commit check was changed from using PHP 5.4 to using PHP
7.0. Somewhere in that process, something got broken with regards to the output 
of the error messages resulting from this check. So, none of the errors show up.

This can be confusing, especially if you’re not running PHP 7.0 yet, because PHP
7 is actually a lot more strict about this sort of thing. You can run the PHP lint
process yourself on your own files all day long and not see what the issue is, because
it *only* comes up in PHP 7.

My advice: [Grab a copy of PHP 7](https://secure.php.net/downloads.php) for your
machine, and run “php -l” on the file you’re getting an error message about. There
is a valid error, you’re just not seeing it on older PHP versions, which were not
quite so picky.

One known case that seems to be cropping up a lot:

The “break” and “continue” keywords are only valid inside a _for_, _foreach_, _while_,
_do-while_, or _switch_ structure. You’ll get the error message of “Fatal error:‘
break’ not in the ‘loopLoop The Loop is PHP code used by WordPress to display posts.
Using The Loop, WordPress processes each post to be displayed on the current page,
and formats it according to how it matches specified criteria within The Loop tags.
Any HTML or PHP code in the Loop will be processed on each post. [https://codex.wordpress.org/The_Loop](https://codex.wordpress.org/The_Loop)’
or ‘switch’ context in my-cool-plugin.php on line 123”

We’ve been seeing code that has something like this in it:

    ```notranslate
    if ( is_thing() ) {
      do_thing();
      break;
    }
    ```

And that is invalid in PHP unless that if is inside a loop. But, previous versions
of PHP didn’t show the problem in their lint processes. Not so with PHP 7.

So, make sure to check your code with PHP 7. It’s no fun for people using the newest
systems, like we always recommend, to be running into syntax errors. Note that these
were actually syntax errors in previous versions of PHP as well (using break and
continue makes no sense outside of a loop structure), but now you’re getting told
about them by the lint process.

We’re still working on finding the bug not showing you these errors in the pre-commit
checks too. 🙂

Edit: Any plugins uploaded to the directory should still be PHP 5.2 compatible. 
Just because we’re allowing PHP 7 code doesn’t mean this is a free-for-all.

Look at https://wordpress.org/about/stats/ . This isn’t complicated. Your main plugin
file can be installed and activated on any of those sites. If you have even 5.3-
only code in that main file, then you are responsible for breaking that person’s
website, and *you* will get the appropriate review from them for doing so. And we
are not going to delete that review just because you ask nicely…

Make your plugin handle failure cases properly. If you want to limit your userbase,
then you’re welcome to do so. But do it right. Add code to the plugin to [fail gracefully on older systems](https://make.wordpress.org/plugins/2015/06/05/policy-on-php-versions/).

### Share this:

 * [  Threads ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=bluesky)
 * [  X ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=x)
 * [  Facebook ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/plugins/2016/07/14/known-issues-with-pre-commit-to-the-plugins-svn/?share=linkedin)

 1.  ![](https://secure.gravatar.com/avatar/b01ec0896d3867ba97ca655f843bce74d396f9018a844d665e5e513297930de1?
     s=32&d=mm&r=g)
 2.   [Rami Yushuvaev](https://profiles.wordpress.org/ramiy/)  9:44 pm _on_ July 14,
     2016
 3.  Thanks for sharing…
 4.  ![](https://secure.gravatar.com/avatar/f120c99131992985e84f8976533edf6b03a87580249de49befb9ecf1e8ae0fea?
     s=32&d=mm&r=g)
 5.   [Anton Korotkoff](https://profiles.wordpress.org/anton-korotkoff/)  12:43 pm 
     _on_ July 27, 2016
 6.  btw, `php -l` returns exactly the same error message: “Errors parsing “. No any
     additional information.
 7.  ![](https://secure.gravatar.com/avatar/f6df3462e7cbfb430fa8ecd6226041d830f1cbe3f7b8d4641e03caa0884da563?
     s=32&d=mm&r=g)
 8.   [UaMV](https://profiles.wordpress.org/uamv/)  5:10 am _on_ August 5, 2016
 9.  This saved me tonight. I had gotten tangled in SVNSVN Short for "SubVersioN", 
     it's the code management system used to maintain the plugins hosted on WordPress.
     org. It's similar to git. and was breaking sites. Thank you for the heads up!

Comments are closed.

# Post navigation

[← New Repo Open Beta](https://make.wordpress.org/plugins/2016/07/14/new-repo-open-beta/)

[Security Alert: Httpoxy →](https://make.wordpress.org/plugins/2016/07/20/security-alert-httpoxy/)