Problem/Motivation

If a request contains an invalid consumer ID (in the header or query parameter), a PHP fatal error is thrown:

Call to a member function uuid() on null in Drupal\consumers\Negotiator->negotiateFromRequest()

Steps to reproduce

Make a request without a consumer in the request and verify that everything is working as expected. Add ?consumerId=foo to the request URL and see that there is a fatal error. Now replace "foo" with the actual UUID of a consumer and verify that everything is fine again.

Proposed resolution

Fall back to the default consumer if an invalid one is passed. Since there is the concept of falling back to the default anyway (if none is passed explicitly) this seems to be in-line with the current semantics. Alternatively, a proper exception could be thrown, but that would be a change in documented behavior (not in actual behavior, because right now there is a fatal already).

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork consumers-3267346

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Status: Active » Needs review
tstoeckler’s picture

Issue summary: View changes

Adding the error message to the issue summary for searchability.

e0ipso’s picture

I missed you my friend!

This looks like a good improvement, and straight forward enough.

  • e0ipso committed fe5edf7 on 8.x-1.x authored by tstoeckler
    Issue #3267346 by tstoeckler, e0ipso: Invalid consumer ID leads to...
e0ipso’s picture

Status: Needs review » Fixed
tstoeckler’s picture

 ❤️ yes, you as well! ☺️

Thanks for the super quick turnaround. Much appreciated, as well!

Status: Fixed » Closed (fixed)

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