Software Licensing Theme & Plugin examples updated to fix PHP compatibility bug.

As some of our Software Licensing customers may have noticed, the plugin has been getting updated more frequently as of late due to a focus on fixing some long standing bugs and adding improvements to the plugin. In the most recent update 3.4.9, we added some much needed error handling to the license activation, deactivation, and status check methods. These changes were included in our sample plugin and theme. After release, we saw a few tickets slowly trickle in about some PHP errors happening to our customers’ users related to an error that reads similarly to, “Fatal error: Can’t use method return value in write context”.

This error happens in versions of PHP earlier than 5.5, and is commonly caused by using something like the `empty` function within the context of an `if` statement. In the process of updating our error message handling, we had been checking for an error message on a possible `WP_Error` object. By doing so, it rendered the sample updater not compatible with versions of PHP versions 5.2, 5.3, and 5.4.

Since identified by our customers and confirmed, we’ve updated the samples included with Software Licensing to contain a version of these error handlers that are compatible with PHP versions all the way back to 5.2. These updates do not require you update the Software Licensing plugin itself, but if you’ve recently implemented our newest samples into your product, you’ll need to download the most recent update to the examples from the Your Account section of the Easy Digital Downloads site and apply the necessary changes.

Here is a set of the changes made:

In the course of this issue, we’ve identified that the process we use in testing our updates to Software Licensing have mainly been isolated to the core Software Licensing extension itself, and while we do test the samples, they usually get less focus than the main plugin. This is going to change. We’ve always included the samples and considered them a guideline at implementing the Software Licensing API. Over time, as it’s become more robust, it’s become a simple way to implement a licensing solution to themes and plugins. This wasn’t our initial intentions, but as it’s being implemented this way, it’s time we focus on making the deliverables of the samples more robust for our customers. Going forward, we’ll be working on a checklist, and if possible, automated testing for our samples so that we can avoid situations like this in the future. It’s a tough day when we affect our customers’ reliability, but it’s an even tougher day when we affect our customers’ customers.

One response... add one

Leave a Reply

Your email address will not be published.