Closed bugfolder closed 4 months ago
When creating a new order, this warning appears:
Deprecated function: function_exists(): Passing null to parameter #1 ($function) of type string is deprecated in uc_order_pane_payment() (line 92 of /mysite/modules/contrib/ubercart/payment/uc_payment/uc_payment_order_pane.inc).
Lines 90–92 are:
$method = isset($form_state['values']['payment_method']) ? $form_state['values']['payment_method'] : $order->payment_method; $func = _uc_payment_method_data($method, 'callback'); if (function_exists($func) && $details = $func('order-details', $order)) {
The problem is that when an order is newly created, there is no payment method so $method is empty, so $func is NULL.
$method
$func
This should be hardened as follows:
$method = isset($form_state['values']['payment_method']) ? $form_state['values']['payment_method'] : $order->payment_method; $func = _uc_payment_method_data($method, 'callback'); if (!empty($func) && function_exists($func) && $details = $func('order-details', $order)) {
PR to follow.
Looks good!
When creating a new order, this warning appears:
Deprecated function: function_exists(): Passing null to parameter #1 ($function) of type string is deprecated in uc_order_pane_payment() (line 92 of /mysite/modules/contrib/ubercart/payment/uc_payment/uc_payment_order_pane.inc).
Lines 90–92 are:
The problem is that when an order is newly created, there is no payment method so
$method
is empty, so$func
is NULL.This should be hardened as follows:
PR to follow.