I just installed woocommerce 2.0 (on Wordpress) on PHP 5.4, and I got this:
Strict Standards: Declaration of WC_Gateway_BACS::process_payment() should be compatible with WC_Payment_Gateway::process_payment() in D:\my\path\to\htdocs\wordpress\plugins\woocommerce\classes\gateways\bacs\class-wc-gateway-bacs.php on line...
I check the files and found that WC_Payment_Gateway
have no method process_payment()
.
I need to know how to resolve this (not by setting error_reporting()
).
What is Strict Standards in PHP exactly?
In what condition so we get that error?
WC_Payment_Gateway
is defined in abstract-wc-payment-gateway.php
and declares a method
function process_payment() {}
while WC_Gateway_BACS
defines it as
function process_payment( $order_id ) { ...
(maybe you mixed up WC_Payment_Gateway and WC_Payment_Gateways).
So, different signature (0 parameters vs 1 parameter) -> strict error.
Since it seems* to be used always with one parameter you could change
function process_payment() {}
to
function process_payment($order_id) {}
(*) keep in mind I know of woocommerce only since the last five minutes, so don't take my word for it.
Quote from PHP Manual
In PHP 5 a new error level E_STRICT is available. Prior to PHP 5.4.0 E_STRICT was not >included within E_ALL, so you would have to explicitly enable this kind of error level in >PHP < 5.4.0. Enabling E_STRICT during development has some benefits. STRICT messages >provide suggestions that can help ensure the best interoperability and forward >compatibility of your code. These messages may include things such as calling non-static >methods statically, defining properties in a compatible class definition while defined in >a used trait, and prior to PHP 5.3 some deprecated features would issue E_STRICT errors >such as assigning objects by reference upon instantiation.
You are receiving this error because WC_Gateway_BACS::process_payment() declaration is different than WC_Payment_Gateway::process_payment() (might be not the same amount of parameters etc). If WC_Payment_Gateway has no method process_payment, check it's parent class :)
Also, if you want to disable STRICT errors, add ^ E_STRICT to your error reporting configuration, for example:
error_reporting(E_ALL ^ E_STRICT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With