Skip to content

It comes the exception error when buying virtual product (php8) #61

@f123248

Description

@f123248

There are no shipping description when buying the virtual product so it wil comes up the exception error and crash the riskfied review flow.

The error happens at 586 of vendor/riskified/magento2new/Model/Api/Order/Helper.php

   public function getShippingLines()
    {
        return [
            [
                'price' => floatval($this->getOrder()->getShippingAmount()),
                'title' => strip_tags($this->getOrder()->getShippingDescription()),
                'code' => $this->getOrder()->getShippingMethod()
            ]
        ];
    }

It should be checked the value first in php 8

   public function getShippingLines()
   {
       return [
           [
               'price' => floatval($this->getOrder()->getShippingAmount()),
               'title' => is_null($this->getOrder()->getShippingDescription()) ? '' : strip_tags($this->getOrder()->getShippingDescription()),
               'code' => $this->getOrder()->getShippingMethod()
           ]
       ];
   }

Currently results in an error:

Order.CRITICAL: Exception: Deprecated Functionality: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions