Bug report: strMasterAlias false positive when module is embedded in a calendar event reader page
Version: 1.32.52
Contao version: 4.13
Description
When a catalog-manager module (ModuleUniversalView) is inserted into a Contao calendar event reader page, a 500 error occurs.
The root cause is in the compile() method, at the condition:
$this->strMasterAlias && !$this->catalogPreventMasterView
On a calendar event reader page, the current URL contains the event alias. The module picks it up and assigns it to $this->strMasterAlias, then enters master view mode assuming the alias belongs to a catalog record. Since no catalog record matches the event alias, the module fails with a 500 error.
Steps to reproduce
- Create a calendar event reader page in Contao 4.13.
- Insert a catalog-manager universal view module on that page.
- Open any calendar event URL (e.g.
/events/my-event-alias.html).
- A 500 error is thrown inside
ModuleUniversalView::compile().
Expected behavior
The module should not enter master view mode unless the current alias actually matches a record in the catalog table. A non-catalog alias (such as a calendar event alias) should be ignored.
Suggested fix
Before entering master view mode, verify that the alias resolves to an existing catalog record:
if ($this->strMasterAlias && !$this->catalogPreventMasterView) {
$objResult = \Database::getInstance()
->prepare("SELECT id FROM " . $this->catalogTablename . " WHERE alias = ? LIMIT 1")
->execute($this->strMasterAlias);
if ($objResult->numRows < 1) {
$this->strMasterAlias = null;
}
}
This ensures the master view logic is only triggered when the alias genuinely belongs to the configured catalog table.
Happy to submit a pull request if this approach is confirmed.
Bug report: strMasterAlias false positive when module is embedded in a calendar event reader page
Version: 1.32.52
Contao version: 4.13
Description
When a catalog-manager module (ModuleUniversalView) is inserted into a Contao calendar event reader page, a 500 error occurs.
The root cause is in the
compile()method, at the condition:On a calendar event reader page, the current URL contains the event alias. The module picks it up and assigns it to
$this->strMasterAlias, then enters master view mode assuming the alias belongs to a catalog record. Since no catalog record matches the event alias, the module fails with a 500 error.Steps to reproduce
/events/my-event-alias.html).ModuleUniversalView::compile().Expected behavior
The module should not enter master view mode unless the current alias actually matches a record in the catalog table. A non-catalog alias (such as a calendar event alias) should be ignored.
Suggested fix
Before entering master view mode, verify that the alias resolves to an existing catalog record:
This ensures the master view logic is only triggered when the alias genuinely belongs to the configured catalog table.
Happy to submit a pull request if this approach is confirmed.