In ubercart/uc_order/src/Form/OrderCreateForm.php at line 103 ubercart is trying to get the form values of the user search with

$form_state->getValue(['customer', 'first_name'])

and so on. At that point the value is always empty.

To get the search values you need to call


So instead of

->condition('o.billing_first_name', db_like(trim($form_state->getValue(['customer', 'first_name']))) . '%', 'LIKE')

my db_select condition looks like

->condition('o.billing_first_name', db_like(trim($user_input['customer']['first_name'])) . '%', 'LIKE')
Members fund testing for the Drupal project. Drupal Association Learn more


mathiasgmeiner created an issue. See original summary.

pifagor’s picture

pifagor’s picture

Status: Active » Needs review
mathiasgmeiner’s picture

Based on your patch I removed the deprecated db_select, db_or and db_like.

Status: Needs review » Needs work

The last submitted patch, 4: 2807491.patch, failed testing.

pifagor’s picture

Status: Needs work » Needs review
pifagor’s picture

2807491.patch, failed testing

TR’s picture

Status: Needs review » Needs work

$form_state->getUserInput() returns unsanitized and unvalidated user input. That's not what we want here. As the documentation says, "These are raw and unvalidated, so should not be used without a thorough understanding of security implications. In almost all cases, code should use self::getValues() and self::getValue() exclusively." Which is what is currently done.

The meaning of "deprecated" in the case of db_select etc. is that they will be removed for Drupal 9 - that's at least 5 years in the future. The recommendation method for new code is to inject the connection into the form, not to call the static getConnection() method. See

I welcome a new patch with the connection properly injected, and without the getUserInput().

mathiasgmeiner’s picture

Thanks for the clarification! I try to create a proper patch in the next few days.

mathiasgmeiner’s picture

After hours of trying I'm still not able to retrieve the form values with getValue() it just works with getUserInput(). Is your form fully functional with getValue()?