EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Inconsistent behaviour when no entityId is passed to detail page

Open harmbandstra opened this issue 9 months ago • 0 comments

Describe the bug

I sometimes see errors in Sentry caused by users messing with the URL (probably unintentional). This led me to the following

When I visit this URL: /admin?crudAction=detail&crudControllerFqcn=SomeCrudController&entityId=123 It will show the detail page

When I visit this URL: /admin?crudAction=detail&crudControllerFqcn=SomeCrudController&entityId= It will show a 404 not found page

When I visit this URL: /admin?crudAction=detail&crudControllerFqcn=SomeCrudController It will show a 500 internal server error

I am not sure if this is a bug or by design, but I feel the last one should also return a 404 and not a 500.

If this is indeed a bug, I can create a fix if you point me in the right direction as it can be handled in various parts of the application (AbstractCrudController, AdminContextFactory)

To Reproduce

Got to a detail page and remove the entityId query parameter.

(OPTIONAL) Additional context

When the entityId is not in the URL, the request is processed and fails when it enters the FormLayoutFactory. In my case, with this message "When using form columns, all fields must be rendered inside a column. However, your field "name" does not belong to any column. Move it under a form column or create a new form column before it.".

harmbandstra avatar May 03 '24 07:05 harmbandstra