After a recent update of our Advanced Ads ad management plugin a few users contacting us regarding 500 or 502 errors in their WordPress frontend, which practically meant a blank page.

It took me a while to identify the following line as the cause, since it worked perfectly on all of our sites:

This line basically checks if a function in our Tracking add-on exists in order to add a compatibility fix.

Even though we were able to fix it by rewriting this line I wanted to know what caused this, so we kept digging.

We were finally able to reproduce the error on the following server setup:

  • CentOS release 6.8
  • Apache/2.2.15
  • PHP Version 5.3.29, Apache module
  • Zend Guard Loader v3.3

The most important part here is Zend Guard Loader.

The following error showed up in the Apache error_log:

There is no error given in the debug.log of WordPress, this is why it took us a while.

The problem is basically only happening to those without the Tracking add-on installed and Zend Guard Loader running on the server.

The fix is simple. Just check if the class exists using class_exists . Hence, our line from above looks like this:

Bottom line: we always check the class individually now.

If this helped you to find a bug and fix a problem, take a look at Advanced Ads and support us.

The Author