When editing an article in the Joomla Administrator, a fatal "Division by zero" exception is thrown if a Custom Field of type "Subform" exists without any child fields.
The exception occurs in:
layouts/joomla/form/field/subform/repeatable-table.php
The layout executes:
$fields = $tmpl->getGroup('');
$th_width = 92 / count($fields);
When the Subform contains no child fields, count($fields) returns 0, causing a Division by zero exception and preventing the article edit page from loading.
Debugging confirmed:
Field ID: jform_com_fields_fyld_dwm
Fields Count: 0
The Subform returned an empty field list.
5.4
Joomla should not crash when a Subform contains no child fields.
Instead, it should either:
A fatal "Division by zero" exception should never occur because of an empty Subform configuration.
The Administrator article edit page crashes with:
Division by zero
Call Stack:
JROOT/layouts/joomla/form/field/subform/repeatable-table.php
The page cannot be opened until the empty Subform Custom Field is deleted.
Joomla Version: 5.4.7
PHP Version: 8.3
Database: MySQL / MariaDB
Web Server: Apache
The issue occurs in the Administrator while editing com_content articles.
The problem disappears immediately after deleting the empty Subform Custom Field.
A fatal error should never occur because of an invalid or empty Subform configuration.
Although an empty Subform configuration may be considered invalid, Joomla should validate this condition before calculating the table column width.
A simple guard before the following line would prevent the fatal exception:
$th_width = 92 / count($fields);
For example:
$fields = $tmpl->getGroup('');
if (empty($fields)) {
return;
}
or any equivalent validation that prevents division by zero.
| Labels |
Added:
bug
|
||
| Labels |
Added:
No Code Attached Yet
|
||
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-07-27 02:51:36 |
| Closed_By | ⇒ | QuyTon |
Confirmed. Would you like to make a PR yourself?