Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

php - Strict Standards: Declaration of ' ' should be compatible with ' '

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:mypathohtdocswordpresspluginswoocommerceclassesgatewaysacsclass-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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...