No Code Attached Yet
avatar WM-Loose
WM-Loose
17 Feb 2026

Initial situation:
A post in a category has a module embedded (using loadmoduleid or loadposition).
Create a new "Posts" module and add the category containing the aforementioned post to it.
Integrate the "Posts" module into your website.

Result:
When accessing the website (menu item with the "Posts" module), a 500 error appears.

Reason:
The module is being loaded within the module. Memory is being used up.

avatar WM-Loose WM-Loose - open - 17 Feb 2026
avatar WM-Loose WM-Loose - change - 17 Feb 2026
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 17 Feb 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Feb 2026
avatar WM-Loose
WM-Loose - comment - 17 Feb 2026

It crashes when the "Show introductory text" option is enabled in the module and only one post from the selected categories loads a module (i.e., something with loadmoduleid is included in the post).

Then you get a 500 error in the frontend for that page.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46899.

avatar WM-Loose
WM-Loose - comment - 19 Feb 2026

Joomlaplates has solved it this way with its modules (Unfortunately, I cannot upload an MD file, so I'm using a txt file.):


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46899.
avatar WM-Loose
WM-Loose - comment - 19 Feb 2026

Issue: Memory Overflow durch Endlos-Rekursion bei {loadmodule} / {loadposition} in Artikeln

Modul: mod_articles (Joomla 5.2+ Core-Modul)
Schweregrad: Kritisch (PHP Fatal Error: Out of Memory)
Betrifft: Joomla 5.x und 6.x


Problembeschreibung

Wenn ein Artikel, der von mod_articles angezeigt wird, im Introtext oder Fulltext einen {loadmodule ...} oder {loadposition ...} Tag enthält, kann es zu einem PHP-Speicherüberlauf (Memory Exhausted) kommen. Die Seite wird nicht mehr geladen und der Server gibt einen HTTP 500 zurück.


Ursache: Schritt-für-Schritt-Erklärung

Normaler Ablauf (ohne Problem)

1. Seite wird geladen
2. mod_articles lädt Artikel aus der Datenbank
3. Introtext wird mit content.prepare verarbeitet (Content-Plugins laufen)
4. Artikel wird im Frontend angezeigt

Ablauf mit Rekursion (das Problem)

1. Seite wird geladen
2. mod_articles lädt Artikel aus der Datenbank
3. Artikel X enthält: {loadmodule mod_articles} oder {loadposition slider}
4. content.prepare verarbeitet den Introtext von Artikel X
5. → plg_content_loadmodule findet {loadmodule mod_articles}
6. → plg_content_loadmodule rendert mod_articles ERNEUT
7. → mod_articles lädt wieder alle Artikel, inkl. Artikel X
8. → content.prepare verarbeitet erneut Artikel X
9. → plg_content_loadmodule findet wieder {loadmodule mod_articles}
10. → Endlosschleife → PHP Speicher voll → Fatal Error

Visualisierung

mod_articles
  └─ getArticles()
       └─ Artikel X (enthält {loadmodule mod_articles})
            └─ content.prepare()
                 └─ plg_content_loadmodule
                      └─ mod_articles          ← REKURSION!
                           └─ getArticles()
                                └─ Artikel X
                                     └─ content.prepare()
                                          └─ plg_content_loadmodule
                                               └─ mod_articles    ← REKURSION!
                                                    └─ ... (endlos)

Betroffene Code-Stelle

Datei: src/Helper/ArticlesHelper.php
Methode: getArticles()

Zeile 278 — Artikel werden aus der Datenbank geladen:

$items = $articles->getItems();

Zeile 382 — Introtext wird durch Content-Plugins verarbeitet:

$item->displayIntrotext = HTMLHelper::_('content.prepare', $item->introtext, '', 'mod_articles.content');

HTMLHelper::_('content.prepare', ...) triggert alle Content-Plugins, darunter plg_content_loadmodule. Dieses Plugin sucht nach {loadmodule ...} und {loadposition ...} im HTML und rendert die gefundenen Module — was mod_articles erneut aufruft.

Das Problem: Zwischen dem Laden der Artikel (Zeile 278) und dem Aufruf von content.prepare (Zeile 382) findet keine Prüfung statt, ob ein Artikel problematische Tags enthält.


Lösung

Was wurde geändert?

Direkt nach $articles->getItems() wird ein Filter eingefügt, der Artikel mit {loadposition oder {loadmodule vor der Verarbeitung entfernt:

$items = $articles->getItems();

// Prevent infinite recursion: remove articles containing {loadposition} or
// {loadmodule} before content plugins run.
$items = array_values(array_filter($items, function ($item) {
    $text = ($item->introtext ?? '') . ($item->fulltext ?? '');

    return stripos($text, '{loadposition') === false
        && stripos($text, '{loadmodule') === false;
}));

Warum dieser Ansatz?

Ansatz Bewertung
SQL-Filter (NOT LIKE) Möglich, aber der Articles-Model-State unterstützt keinen Content-Text-Filter. Müsste das Model hacken.
Post-Load Filter (gewählt) Sicher, einfach, kein Eingriff in das Core-Model. Filter läuft nach dem DB-Query aber vor content.prepare.
Rekursions-Zähler Fragil, schwer zu debuggen, löst das Problem nicht an der Wurzel.

Warum vor content.prepare und nicht danach?

Der Artikel darf gar nicht erst in die Plugin-Pipeline gelangen. Wenn content.prepare einmal aufgerufen wird, ist die Rekursion bereits gestartet, bevor ein nachgelagerter Filter greifen könnte.


Betroffene Szenarien

Szenario Ohne Fix Mit Fix
Artikel ohne {loadmodule} Normal angezeigt Normal angezeigt
Artikel mit {loadmodule mod_articles} Memory Overflow Artikel wird übersprungen
Artikel mit {loadposition xyz} (Position enthält mod_articles) Memory Overflow Artikel wird übersprungen
Artikel mit {loadmodule mod_menu} (kein mod_articles) Funktioniert zufällig Artikel wird übersprungen*

*Konservativer Ansatz: Auch {loadmodule mod_menu} wird gefiltert, da nicht feststellbar ist, ob die geladene Position/Modul-Instanz wiederum mod_articles enthält. Sicherheit geht vor.


Reproduktion

  1. Joomla 5.x oder 6.x installieren
  2. mod_articles auf einer Seite einbinden
  3. Einen Artikel erstellen mit folgendem Introtext:
    Dies ist ein Testartikel. {loadmodule mod_articles}
    
  4. Sicherstellen, dass dieser Artikel in der Kategorie liegt, die mod_articles anzeigt
  5. Seite im Frontend aufrufen → HTTP 500 / White Screen / PHP Fatal Error: Allowed memory size exhausted

Test nach dem Fix

  1. Fix einspielen (siehe oben)
  2. Joomla Cache leeren
  3. Seite im Frontend aufrufen → Seite lädt normal
  4. Der Artikel mit {loadmodule} wird nicht angezeigt (korrekt)
  5. Alle anderen Artikel werden normal angezeigt

Geänderte Datei

  • mod_articles/src/Helper/ArticlesHelper.php — Filter nach getItems(), vor der foreach-Schleife

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46899.
avatar chmst
chmst - comment - 20 Feb 2026

Related #39529

avatar chmst
chmst - comment - 20 Feb 2026

I can reproduce the effect. The AI generated solution in #46899 (comment) however, which removes all loadmodules from articles before rendering a mod_articles seems not appropriate.
I suggest to close this #39529 (comment)

avatar brianteeman
brianteeman - comment - 20 Feb 2026

Do i understand correctly that the problem only occurs when you have an article that is loading articles embedded into it causing the recursion and not a general problem with any embedded module. If so then I would file this under won't fix as at the end of the day its the user who is creating the endless loop by their own action and not Joomla AND there would be no way programatically to prevent this.

avatar WM-Loose
WM-Loose - comment - 20 Feb 2026

It's about posts in which a module is loaded, and then this post, including the module, is loaded again into the module posts. The user cannot know that something like this (a module in the post) will then produce an error in the module view of posts.

avatar brianteeman
brianteeman - comment - 20 Feb 2026

why would you ever do that? the proposed solution would remove all modules even if they wouldnt cause a recursive loop - that would not be a sensible solution

avatar WM-Loose
WM-Loose - comment - 20 Feb 2026

We implemented it in our JoomlaPlates UIKIT modules as I've shown in the code. This avoids this loop and 500 errors in the frontend. There should still be a better solution, though. Do you have a better idea, Brian?

avatar brianteeman
brianteeman - comment - 20 Feb 2026

no

avatar WM-Loose
WM-Loose - comment - 21 Feb 2026

We have now solved it so that the user can decide whether it is excluded or not.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46899. Image

Add a Comment

Login with GitHub to post a comment