首頁>Web>source

提交Review的付款详细資訊後,在... / checkout / ID / order_information頁面上出現以下錯誤。

Exception: Serialization of 'Closure' is not allowed in serialize() (line 14 of core/lib/Drupal/Component/Serialization/PhpSerialize.php).

我試圖用 try/catch捕获異常   阻止,但如果我未選中付款資訊表單中的我的账單資訊与我的送货資訊複選框一樣,它始终会帶来致命錯誤。

我正在使用我的自定義付款方式模組进行付款.我應该在哪裏尋找匯致致命錯誤的原因?

__ construct()方法:-

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, PaymentTypeManager $payment_type_manager, PaymentMethodTypeManager $payment_method_type_manager, TimeInterface $time) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $payment_type_manager, $payment_method_type_manager, $time);
  if ($this->getMode() === 'test') {
    $url = "url given here";
  }
  else {
    $url = "url given here";
  }
  try {
    $this->soapClient = new SoapClient($url);
  }
  catch (SoapFault $e) {
    throw new PaymentGatewayException($e->getMessage());
  }
}
最新回復
  • 2020-5-27
    1 #

    我相信這是由於在SOAP客戶端中載入了一个連線,並使用 $this->soapClient將其儲存在記憶體中 .問题是soap客戶端無法序列化.序列化通常是將某物轉換為字元串的過程,因此可以將其儲存在資料庫或檔案或某物中,以備後用. SOAP連線無法儲存,這就是您面临此問题的原因。

    您可以將SOAP客戶端儲存在construct方法中,然後在實際需要時使用该客戶端进行連線.我猜測没有連線的客戶端可能可以序列化.不過,我可能是錯的,您可能需要在每次需要時動態呼叫soap客戶端。

  • wordpress:Ajax响應未收到
  • wordpress:如何使用陣列在資料庫中插入多行和多列