Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$arrItems[$idxLastItem]['href'] = Environment::get('request'); #6

Open
erikherbert opened this issue Dec 1, 2024 · 1 comment
Open
Assignees

Comments

@erikherbert
Copy link

Context
Contao version: 5.4.6
Bundle version: 2.0.1
PHP version: 8.3

CONTAO Blocks Failure by opening a News Detailpage from the News listview.

request.CRITICAL: Uncaught PHP Exception TypeError: "Cannot access offset of type array on array" at Hooks.php line 71 {"exception":"[object] (TypeError(code: 0): Cannot access offset of type array on array at project/public/vendor/heimrichhannot/contao-blocks/src/Controller/Hooks.php:71)"}

71: $arrItems[$idxLastItem]['href'] = Environment::get('request');

Scheinbare Lösung:

        if (is_array($arrItems) && !empty($arrItems)) {
            end($arrItems); // Das letzte Element
            $idxLastItem = key($arrItems); // Index des letzten Elements

            // Letzte Element ein Array?
            if (isset($arrItems[$idxLastItem]) && is_array($arrItems[$idxLastItem])) {
                $arrItems[$idxLastItem]['href'] = Environment::get('request');
            }
        }
@ericges
Copy link
Contributor

ericges commented Jan 23, 2025

@erikherbert Danke für deine Meldung. Das Problem sollte in 2.0.2-beta.0 behoben sein.

Bitte gib bescheid, ob damit jetzt gelöst ist oder nicht. Danke! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants