No PHP warnings should be generated when using the Bootstrap or UiTab helpers.
PHP Warning is generated:
PHP Warning: Undefined array key "Joomla\CMS\HTML\Helpers\Bootstrap::startTabSet" in Bootstrap.php on line 884
Similar issue exists in /libraries/src/HTML/Helpers/UiTab.php on line 92.
Root Cause:
Both Bootstrap.php (line 884) and UiTab.php (line 92) access array keys without checking if they exist:
$active = (static::$loaded[__CLASS__ . '::startTabSet'][$selector]['active'] == $id) ? ' active' : '';
Proposed Fix:
Add isset() check before accessing the array:
$active = (isset(static::$loaded[__CLASS__ . '::startTabSet'][$selector]['active']) && static::$loaded[__CLASS__ . '::startTabSet'][$selector]['active'] == $id) ? ' active' : '';
This defensive programming approach prevents warnings when extensions call addTab() but the initialization in startTabSet() didn't complete properly or the array key doesn't exist.
Files affected:
| Labels |
Added:
No Code Attached Yet
|
||
After further investigation, I agree I cannot reproduce the specific circumstances that triggered the error or identify which extension/code path caused it.
The extensions using these helpers (ConvertForms, DPCalendar, JCE, Edocman) all properly call startTabSet in their code. You're right that the warning only appears when startTabSet isn't called correctly.
However, the isset() check would still be defensive programming - it would gracefully handle edge cases (incorrect extension usage, race conditions, etc.) without breaking functionality, simply defaulting to non-active state when the key doesn't exist.
That said, without concrete reproduction steps, I understand this might be insufficient for a core change.
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-01-31 04:29:34 |
| Closed_By | ⇒ | joomdonation |
However, the isset() check would still be defensive programming - it would gracefully handle edge cases (incorrect extension usage, race conditions, etc.) without breaking functionality, simply defaulting to non-active state when the key doesn't exist.
Doing that would just hide the issue, so it is nothing better. Ideally, it should throw LogicException so that developer knows about the error (startTabSet needs to be called before calling addTab) but it would make current users unhappy.
So for the time being, I would leave it as how it is. If users see these notices, they can report to developers of the extensions and have the issue fixed properly. With that said, I will close this issue instead of having it stays open here forever. Feel free to re-open it if you do not agree. Thanks !
Can't replicate this with the following code:
or
I can only get a warning if I don't call
startTabSet:But that seems to me more of a misunderstanding on how the helper function works...