PhpEnums icon indicating copy to clipboard operation
PhpEnums copied to clipboard

Extra not found on Enum in production

Open ker0x opened this issue 2 years ago • 5 comments
trafficstars

I have a weird behavior using extra with my enums on my production server.

An Error Occurred! Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("No value for extra "color" for enum case App\Core\Enum\AlertStatus::Success")." at /srv/app/templates/components/alert.html.twig line 1

This does not happen in dev or test environment and all my tests passed 😕 .

Server specs:

  • Symfony 6.2
  • PHP 8.2.4

Project:

Have you ever encountered such a problem?

ker0x avatar Mar 28 '23 15:03 ker0x

Hi. Did you clear the cache in prod env in between your changes?

symfony console c:c -e prod

ogizanagi avatar Mar 29 '23 07:03 ogizanagi

Hello!

Yes, the cache is clear after each deployment

ker0x avatar Mar 29 '23 07:03 ker0x

Ok, I think i can confirm this is due to calling getExtra()

If i use a simple match expression, there is no more errors in production!

ker0x avatar Mar 30 '23 10:03 ker0x

I didn't encounter such an issue so far, though 🤷🏻‍♂️

ogizanagi avatar Mar 30 '23 11:03 ogizanagi

same problem here, extra not found on Enum in production. I clear cache also but that not fix the issue

Ecureuilvirtuel avatar Apr 09 '23 22:04 Ecureuilvirtuel