Skip to content

Temando Shipping assumes no other ExtensionAttribute users #12921

@ghost

Description

Preconditions

  1. Magento 2.2.2

Steps to reproduce

  1. Create an extension that sets an extension attribute on Magento\Quote\Api\Data\AddressInterface during the quote totals collection process
  2. Create new order via the admin
  3. Click Add Products
  4. Select a product, set quantity to 1 and click Add Selected Products to Order

Expected result

  1. Products are added

Actual result

  1. Server 500 error

2017/12/29 13:01:10 [error] 347#0: *1657 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Temando\Shipping\Model\Checkout\Address::setServiceSelection() must be of the type array, null given, called in /var/www/vendor/temando/module-shipping-m2/Observer/SaveCheckoutFieldsObserver.php on line 76 and defined in /var/www/vendor/temando/module-shipping-m2/Model/Checkout/Address.php:78 Stack trace: #0 /var/www/vendor/temando/module-shipping-m2/Observer/SaveCheckoutFieldsObserver.php(76): Temando\Shipping\Model\Checkout\Address->setServiceSelection(NULL) #1 /var/www/vendor/magento/framework/Event/Invoker/InvokerDefault.php(72): Temando\Shipping\Observer\SaveCheckoutFieldsObserver->execute(Object(Magento\Framework\Event\Observer)) #2 /var/www/vendor/magento/framework/Event/Invoker/InvokerDefault.php(60): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Temando\Shipping\Observer\SaveCheckoutFieldsObserver), Object(Magento\Framework\Event\Observer)) #3 /var/www/vendor/magento/framework/Event/Manager.php(66" while reading response header from upstream, client: 172.17.0.3, server: localhost, request: "POST /admin/sales/order_create/loadBlock/block/search,items,shipping_method,totals,giftmessage,billing_method?isAjax=true HTTP/1.0", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "ce-2-2-2-s9ek75.jenkins.fooman.co.nz", referrer: " https://example.com/admin/sales/order_create/index/"

Likely culprit is
Temando\Shipping\Observer\SaveCheckoutFieldsObserver as this code assumes no other module might be setting extension attributes on the quote address:

    if (!$quoteAddress->getExtensionAttributes()) {
        return;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions