Problem/Motivation

A good example of why this is a problem is explained in #1906810: Require type hints for automatic entity upcasting. But in a nutshell, an exception is thrown for a circular dep (for a test testing there is no circular dep :)) but exception caught in index.php are just printed to screen. PHP will default to a 200 in this case, as as far as it knows, it's just printing some strings.

Proposed resolution

Make sure we set the response status code to 500 in this case.

Remaining tasks

Do it.

User interface changes

None

API changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Status: Active » Needs review
FileSize
415 bytes

Let's see what fails then, LocaleLocaleLookupTest I am expecting at the very least.... (I would be very surprised if that was the only one.)

Status: Needs review » Needs work

The last submitted patch, 1: 2284111.patch, failed testing.

damiankloip’s picture

Well, well. It is the only one! :)

Berdir’s picture

FileSize
8.14 KB

This works but :(

alexpott’s picture

Status: Needs work » Needs review
FileSize
4.08 KB

This works too - and has the advantage of removing the double static cache of base field definitions in the EntityManager and ContentEntityDatabaseStorage.

catch’s picture

Priority: Major » Critical
damiankloip’s picture

That fix looks good to me. Let's wait for berdir to rtbc.

Berdir’s picture

As discussed in IRC, while the patch from alexpott fixes this test, basic_auth for example is still broken in HEAD and currently has no test coverage for this.

The problem there is that it puts a content entity object into the current_user service, which results in a loop when LocaleLookup tries to fetch the roles from it.

So while we could get this in to fix the test, we will need another critical for basic_auth, where we either need TranslationWrapper just for User because we say that is special, for all entities, possibly automated, so they don't have to do it manually, or we refactor LocaleLookup somehow to not to fail if this happens, which could however result in broken caching or we define that doing this is not allowed (putting a user entity into current_user during bootstrap or calling t() at all before the current user is set).

Possibly a combination of something and the last anyway, because calling t() before we have a user is certainly also before we have the correct current language and therefore bogus anyway.

Berdir’s picture

This is what I meant.

The first problem are the t() calls in ContentEntityType and ConfigEntityType annotations but then it quickly goes down the rabbit hole all the way to field item propertyDefinition() methods. So my patch above won't fix this either, we'd have to update all of them too.

Status: Needs review » Needs work

The last submitted patch, 9: circular-dependency-2284111-9.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review

Me and berdir discussed this on IRC. We think it would be ok to get the patch in #5 in with Alex's fix. We will then create a critical follow up for the bigger problem. IMO getting this patch in sooner will be beneficial to stop any other bogus test passes like the one here in LocaleLocaleLookupTest.

NR for patch in #5.

The last submitted patch, 4: 2284111-3.patch, failed testing.

catch’s picture

Status: Needs review » Reviewed & tested by the community

I'm OK with #5 + critical follow-up as well.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, committed and pushed #5 to 8.x.

Marking fixed, although I guess we could just continue to use this issue as the follow-up?

  • Commit 1251cc3 on 8.x by webchick:
    Issue #2284111 by alexpott, Berdir, damiankloip: Fixed Exceptions caught...
damiankloip’s picture

Thanks webchick. I think I would like to see a new issue as a follow up anyway. Reusing issues is..meh. IMO. I like this to look back to as it matches the commit :) I will speak to berdir/alexpott about the follow up as they likely know a bit more detail than I.

Berdir’s picture

damiankloip’s picture

Thanks!

Status: Fixed » Closed (fixed)

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