backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

Make layout manage form more robust, prevent PHP errors #6697

Open indigoxela opened 3 weeks ago

indigoxela commented 3 weeks ago

Description of the bug

We have paths for the layout edit form like for example admin/structure/layouts/manage/home

But if one calls a path like admin/structure/layouts/manage/home/foo or admin/structure/layouts/manage/home/foo/bar/baz one ends up with:

Error
Class name must be a valid object or a string 

If error display's on, also:

    Warning: Trying to access array offset on false in layout_create_renderer() (Zeile 1942 von /var/www/bdroptesting/html/core/modules/layout/layout.module).
    Error: Class name must be a valid object or a string in layout_create_renderer() (Zeile 1942 von /var/www/bdroptesting/html/core/modules/layout/layout.module).

Steps To Reproduce

Simply attach something to the URL of a valid Layout form path. Works with every layout.

Actual behavior

Fatal php error

layout-form-error

Expected behavior

Just the form, or a 404 page... for sure not a fatal error. :wink:

Additional information

argiepiano commented 3 weeks ago

Confirmed. One would expect the same behavior as for other admin paths with inexistent last path parts - reverting to the last available path if a path is not found (e.g. admin/structure/views/nothing/nothing2 reverts to admin/structure/views). Now, the reported error only happens if you manually type the path - so it's unlikely to be encountered in normal UI operation. Still, it'd be good to fix it.

indigoxela commented 3 weeks ago

Now, the reported error only happens if you manually type the path - so it's unlikely to be encountered in normal UI operation.

Define "normal" :stuck_out_tongue_winking_eye: (A customer ran into that by accident...)

Still, it'd be good to fix it.

I think so, too, yes. A little PHP notice wouldn't be worth it, I guess. But a fatal error should really get fixed.