Skip to content

Exception message: Deprecated Functionality: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in magento 2.4.6

I updated my php version is 8.3 and magento version is 2.4.6
currently facing issue with round functionality.

Exception message: Deprecated Functionality: round(): Passing null to parameter #1 ($num) of type int|float is deprecated

Fee.php

$amount = $invoice->getHandlingCharges();
        $amount += round($invoice->getHandlingChargesTax(), 3, PHP_ROUND_HALF_UP);

        $baseAmount = $invoice->getBaseHandlingCharges();
        $baseAmount += round($invoice->getBaseHandlingChargesTax(), 3, PHP_ROUND_HALF_UP);

        $invoice->setGrandTotal($invoice->getGrandTotal() + $amount);
        $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseAmount);

        return $this;

please help