Closed Dernerd closed 8 months ago
Durch die Umwandlung von $amount in eine Gleitkommazahl wird sichergestellt, dass die abs()-Funktion korrekt funktioniert, unabhängig davon, ob $amount eine ganze Zahl, eine Gleitkommazahl oder ein String ist.
//check decimal option if ( (int) ( $amount ) == (float) $amount ) { $decimal_place = 0; } else { $decimal_place = 2; }
//handle negative numbers
$negative_symbol = '';
$amount = floatval($amount);
if ( $amount < 0 ) {
$negative_symbol = '-';
$amount = abs( $amount );
}
Fatal error: Uncaught Error: abs(): Argument #1 ($num) must be of type int|float, string given in /opt/lampp/htdocs/classicpress/wp-content/plugins/psecommerce/includes/common/template-functions.php on line 1048
Call stack:
abs() wp-content/plugins/psecommerce/includes/common/template-functions.php:1048 mp_format_currency() wp-content/plugins/psecommerce/includes/common/helpers.php:144 mp_filter_email() wp-content/plugins/psecommerce/includes/common/class-mp-order.php:287 MP_Order::_send_new_order_notifications() wp-content/plugins/psecommerce/includes/common/class-mp-order.php:1346 MP_Order::save() wp-content/plugins/psecommerce/includes/common/payment-gateways/manual-payments.php:80 MP_Gateway_ManualPayments::process_payment() wp-includes/class-wp-hook.php:308 WP_Hook::apply_filters() wp-includes/class-wp-hook.php:332 WP_Hook::do_action() wp-includes/plugin.php:517 do_action() wp-content/plugins/psecommerce/includes/public/class-mp-checkout.php:1090 MP_Checkout::maybe_process_checkout() wp-includes/class-wp-hook.php:308 WP_Hook::apply_filters() wp-includes/class-wp-hook.php:332 WP_Hook::do_action() wp-includes/plugin.php:565 do_action_ref_array() wp-includes/class-wp.php:797 WP::main() wp-includes/functions.php:1334 wp() wp-blog-header.php:16 require() index.php:17