Autologout does not handle multiple destinations

Created on 27 July 2022, almost 2 years ago
Updated 5 June 2024, about 2 months ago

Problem/Motivation

In some cases, drupal has "destinations" array, where the user might be redirected more than once.
This shows an error: "Undefined index: destination" around AutologoutSubscriber.php:137

if (... && (strpos($parse_url, 'destination') !== FALSE) && ...) {
        parse_str($parse_url, $output);
        $destination_uid = explode("/", $output['destination']);

Now the bug is simple: the if pass this as true, since strpos catch the word, without the "s" at the end.
But $output['destination'] does not works, since the property name is "destinations".

Steps to reproduce

Go with process of adding field to an entity via the admin UI.
(See core module field_ui - FieldUI.php -> getNextDestination() )

Proposed resolution

Either iterate through destinations array (or just pop the last, or the first)

Or ignore this scenario altogether, (since the last redirect will have normal "destination", so no need to process anything at this point)

Change strpos to something that will not detect "destinations".

Remaining tasks

Provide a patch.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇱Israel jkdev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024