How To Fix the Referenced PHPCompatibility Sniff Error

There are a lot of nice packages that we can use in our PHP-based projects and if you’re using Composer or GrumPHP, PHPCompatibility is one that I recommend including your projects especially if you’re writing code for something that’s going to run across multiple versions of PHP (that is, on hosts that offer different versions).

This is a set of sniffs for PHP CodeSniffer that checks for PHP cross-version compatibility. It will allow you to analyse your code for compatibility with higher and lower versions of PHP.

PHPCompatibility Repository

This is something that be installed within composer and it’s something that I recommend for people writing code for WordPress because of how much variation exists within our hosts.

Occasionally, though, you may see a problem like this:

And if you run $ phpcs -i you may get a message that’s unclear.

Continue reading “How To Fix the Referenced PHPCompatibility Sniff Error”

Time Off 2019: Part 3 of 4 of Social Media Sabbaticals (No Time for Four)

If you’ve followed along with the previous articles this year, you’ll notice that I didn’t actually take time off each quarter.

  1. Time Off 2019: Part 1 of 4 of Social Media Sabbaticals
  2. Time Off 2019: Part 2 of 4 of Social Media Sabbaticals

As I head into December of this year, this will be the final – and obviously the third – time I take off the social web for the remainder of the year. At least that’s the plan. I’m thinking of doing it a little bit differently this year.

For those of you who haven’t read about my doing this in years past, check out:

  1. The First Social Media Sabbatical of 2018
  2. The Second Social Media Sabbatical of 2018
  3. The Third Social Media Sabbatical of 2018

Though I don’t really do year in review posts, going back to read these and see how things have panned out over the years is always fun and is as close to retrospectives as I get.

With all of that said, I’d summarize the entire year by saying: It’s been a year, if nothing else. Some ways bad, some was fantastic.

Continue reading “Time Off 2019: Part 3 of 4 of Social Media Sabbaticals (No Time for Four)”

On Retiring Site Memberships

After two years after writing a lot of content and giving exclusive access to site members, this past weekend I opened the site to everyone.

In short:

But this wasn’t a small nor was it a quick decision and it’s not something that I opted to on a whim. For those who were subscribed to the newsletter earlier this year, I made an announcement that this was coming.

Continue reading “On Retiring Site Memberships”

You Should Be Using PHP Filtering Functions, Part 2

In the previous post, I talked about the reasons using PHP filtering functions is more useful rather than not.

In short, doing so helps to provide a level of validation that’s built into the language so that we don’t have to re-write something. Naturally, there are caveats.

For example, if you’re having to validate a value that is of non-Latin characters, then you’re going to go have to go it alone and implement validation with perhaps a regular expression.

But if you’re using email addresses, URLs, numbers, IP addresses, and so many more things, then you’re in a good position to use something that already exists.

Anyway, all of the above is still about filtering variables. What about inputs, though? That is, those that come from $_POST or $_GET. It’s possible to use a similar strategy with a different function and different filter set.

But if you understand the basics presented in the last post, then this post will not be very different.

Continue reading “You Should Be Using PHP Filtering Functions, Part 2”

You Should Be Using PHP Filtering Functions, Part 1

I’ve talked about data sanitization in WordPress in previous posts. This is a topic that’s important not only for those of us working to build solutions for others in WordPress, but also for those who are writing code that will directly interact with a database via PHP.

Sure, there are native WordPress functions to make this process easier, but there are also built-in PHP filtering functions to help with this. Namely filter_var and filter_input and these are things that I think are helpful for PHP developers to know.

Continue reading “You Should Be Using PHP Filtering Functions, Part 1”