So today I did an update to a WooCommerce extension, WooCommerce Brands and ran into an issue where it cause the site to go into a 500 status code. So I contacted WooCommerce support via chat. Went through the normal uploading of the system log for them to take a look. The only thing they came back with is first your template files are out of date and should be updated. My response was I am aware of that but that is not what is causing this issue. Then they came back with your site is running on an outdated PHP version and should be updated. My response was PHP 5.4 is above the required PHP version number for WordPress to run. Took a look at the error log and it showed the following error.
[15-Jun-2018 18:47:22 UTC] PHP Fatal error: Can't use function return value in write context in /home/xxxx/public_html/wp-content/plugins/woocommerce-brands/includes/class-wc-brands-coupons.php on line 108
So I took a look at that line of code and with a little research came across that in PHP 5.4 empty does not like having functions like array_intersect within it. Empty likes having a variable passed to it. So here is the code before I fixed it.
if ( ! empty( $coupon->included_brands ) && empty( array_intersect( $product_brands, $coupon->included_brands ) ) ) { return false; } if ( ! empty( $coupon->excluded_brands ) && ! empty( array_intersect( $product_brands, $coupon->excluded_brands ) ) ) { return false; }
Here is the code after I fixed it.
$included_brands = array_intersect( $product_brands, $coupon->included_brands ); if ( ! empty( $coupon->included_brands ) && empty( $included_brands ) ) { return false; } $excluded_brands = array_intersect( $product_brands, $coupon->excluded_brands ); if ( ! empty( $coupon->excluded_brands ) && ! empty( $excluded_brands ) ) { return false; }
Sure enough I was able to get the WooCommerce Brands extension working again without issue. So I let support know through chat and the first response I got was “Well you are now modifying the code so since you are customizing the plugin it is now outside of our support”. Really? I fix a bug and the response I get is you have now modified it to be custom. No… I fixed a broken plugin to work with the type of server it is running on. I don't even know if it was the PHP 5.4 issue. They then even told me to go do https://woocommerce.com/support-policy/ and see what support does and does not cover. Sure enough I see a section called Bug Fixing.
Bug Fixing
We will fix any defects in our Products as quickly as possible after they are brought to our attention. We will also try to provide a solution via our Helpdesk for smaller defects or errors as a precursor to a more substantial update to the particular Product as part of our scheduled Product updates. If you think you have found a bug, please let us know. If you want to speed up the process, make sure to follow the steps in our self-help guide first. If you don’t, we might ask you to go through those steps.
I also see a section called What Our Support Service Does Not Cover and a Customization section
What Our Support Service Does Not Cover
Our Support Service does not cover our Products supplied by Third Parties who are not our Resellers or Third Party products and services. We may require you to disable Third Party products that are installed alongside our Products before we are able to assist you.
We do not give general WordPress support. You can find resources and and answers around WordPress in the WordPress.org forums
Customization
We provide our Products as is. While we can help you to configure our products within the capabilities of each plugin, we do not customize our Products or support any Third Party customizations of our Products. A customization is anything that changes the way our Products look or function relative to how we make our Products available to you
This product was not purchased or setup through a third party. This product was purchased directly from WooCommerce and was running as is. I had to modify the plugin to get it working because it was not working as is. No customization of the product in any way. I bet you 100% that they will not modify the code to fix this in future releases to make sure there product is better handled across all the different servers out there.
Recent Comments