Upon checking out a product ($0.00) using Free Payment with a Role Assignment I immediately get a white screen saying "website experienced an unexpected error".

The user however, is created, but no email is sent. No transaction is logged.

Looking at the reports I find the following:

Recoverable fatal error: Argument 1 passed to _editor_get_file_uuids_by_field() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Users/mattsaunders/Documents/drupal8/core/modules/editor/editor.module on line 367 and defined in _editor_get_file_uuids_by_field() (line 465 of /Users/mattsaunders/Documents/drupal8/core/modules/editor/editor.module).

I'm running Drupal 8.0.5, a fairly fresh install without many other modules at all (I'm in the process of trialling Ubercart).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webbymatt created an issue. See original summary.

webbymatt’s picture

I found out what was causing this - my product was set to £0.00 because I wanted to test without payment.

Instead, I enabled the Payment Pack module, and added Cash on Delivery as a method. Then I changed the product to £10.00 and went through the process again - no error this time, and the user was created successfully.

TR’s picture

Title: Website experienced an unexpected error » Zero price product generates error when checking out
Version: 8.x-4.0-alpha4 » 8.x-4.x-dev
Component: Roles » Products

Yes, there appears to be a problem with zero-price products, but this is not related to roles. I was able to get to the review page /cart/checkout/review, but when I submit the order I get a whitescreen with that same message, and the same error in the dblog. The order IS placed (using the Free order payment method), and the order details at /admin/store/orders/{uc_order} are correct.

longwave’s picture

Status: Active » Postponed (maintainer needs more info)

I was unable to reproduce this with the steps provided. I have editor.module enabled and checked out with a zero price product, both with and without roles, with both an anonymous and an authenticated user.

Can someone get a full backtrace for this? It would appear to be a problem with an entity update hook but I can't figure out which entity is causing the problem.

TR’s picture

Status: Postponed (maintainer needs more info) » Active

#3 was from installing Ubercart on simplytest.me.
I created another site just now to confirm, r0b0c.ply.st if you want to try it - it will be there until just under 24 hours from now.

Here's what I did:

  1. Set up the site with Ubercart 8.x-4.x and Devel. I chose a country and a time zone during this process.
  2. Enabled just the five core Ubercart modules plus payment and payment pack. (I didn't enable devel).
  3. No store configuration or any other set up was done.
  4. At this point I am logged in as admin, and I stay logged in as admin the whole time.
  5. Created one product with title, body, sku, non-shippable, price =0, weight = length = width = height =1.
  6. Clicked add-to-cart on the product page.
  7. Was redirected to the cart with the correct contents. Clicked checkout.
  8. Was redirected to checkout page. Cart contents show up properly. Filled in billing address. Free order was properly shown selected and greyed out. Clicked review order.
  9. Was redirected to the review order page. All information shows up properly. Nothing in the dblog yet. Clicked submit order.
  10. White screen with "The website encountered an unexpected error. Please try again later."
  11. dblog now shows the error with _editor_get_file_uuids_by_field() mentioned in the original post.
  12. Reloaded the page, redirected to /cart with the expected "There are no products in your shopping cart." message shown.
  13. Visited /admin/store/orders/1. I can see the order with the correct product information and customer address. It is in "Completed" status - the order HAS gone through.
  14. Repeated the process - placed another order with the same product and the same address, got the same result.
longwave’s picture

Managed to obtain a backtrace, will look into this further later:

TypeError: Argument 1 passed to _editor_get_file_uuids_by_field() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in core/modules/editor/editor.module on line 367 in _editor_get_file_uuids_by_field() (line 465 of core/modules/editor/editor.module).

_editor_get_file_uuids_by_field(NULL) (Line: 367)
editor_entity_update(Object)
call_user_func_array('editor_entity_update', Array) (Line: 393)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 174)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 423)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 475)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 309)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 400)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 748)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 363)
Drupal\Core\Entity\Entity->save() (Line: 177)
uc_payment_uc_payment_receipt_insert(Object)
call_user_func_array('uc_payment_uc_payment_receipt_insert', Array) (Line: 393)
Drupal\Core\Extension\ModuleHandler->invokeAll('uc_payment_receipt_insert', Array) (Line: 172)
Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object) (Line: 423)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 475)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 309)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 400)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 748)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 363)
Drupal\Core\Entity\Entity->save() (Line: 157)
uc_payment_enter('6', 'free_order', 0, 0, NULL, Object) (Line: 42)
Drupal\uc_payment\Plugin\Ubercart\PaymentMethod\FreeOrder->orderSubmit(Object) (Line: 97)
uc_payment_checkout_review_form_validate(Array, Object)
call_user_func_array('uc_payment_checkout_review_form_validate', Array) (Line: 88)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'uc_cart_checkout_review_form') (Line: 124)
Drupal\Core\Form\FormValidator->validateForm('uc_cart_checkout_review_form', Array, Object) (Line: 574)
Drupal\Core\Form\FormBuilder->processForm('uc_cart_checkout_review_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm('uc_cart_checkout_review_form', Object) (Line: 217)
Drupal\Core\Form\FormBuilder->getForm('Drupal\uc_cart\Form\CheckoutReviewForm', Object) (Line: 219)
Drupal\uc_cart\Controller\CheckoutController->review()

longwave’s picture

Status: Active » Needs review
FileSize
899 bytes

The problem here is entirely unrelated to editor.module, but is actually that in some cases we save an order object when it is already in the middle of being saved; this is not supported by the entity API. This then triggers a later crash because the entity object is internally corrupted (the "original" property ends up missing when the first order in the stack completes its save process).

The key to me not reproducing this earlier was that I was testing with a shippable product; this bug only occurs when the order is non-shippable.

TR’s picture

The patch in #7 works for me. It would be nice to add a test case to prevent us from having the same problem in the future.

longwave’s picture

Assigned: Unassigned » longwave
Status: Needs review » Needs work
Issue tags: +Needs tests
NetNerdy’s picture

The patch in #7 works for me too.

rfay’s picture

#7 works for me as well, and without it I have a fatal on every checkout. Could we get this committed and keep the issue open for tests? I might even be persuaded to write the test.

longwave’s picture

Modified the existing role test to cover this.

The last submitted patch, 12: 2695639-nested-order-save-test-only.patch, failed testing.

  • longwave committed 64dcc45 on 8.x-4.x
    Issue #2695639 by longwave: Zero price product generates error when...
longwave’s picture

Status: Needs review » Fixed
rfay’s picture

Works for me! Thanks so much.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.