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:
1 |
if ( method_exists( 'Advanced_Ads_Tracking_Plugin' , 'check_ad_tracking_enabled' ) ) { |
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:
1 |
[notice] child pid 20475 exit signal Segmentation fault (11) |
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:
1 2 |
if ( class_exists ('Advanced_ads_Tracking_Plugin') && method_exists( 'Advanced_ads_Tracking_Plugin' , 'check_ad_tracking_enabled' ) ) { |
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.