Skip to content

Commit f334cb4

Browse files
committed
Fix: Prevent null formKey being passed to LabelTag
LabelTag constructor requires string type for $for parameter Added null check to generate unique ID when formKey is null Fixes TypeError when FormGroup is created with null label and content without tag ID
1 parent 402758b commit f334cb4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Ease/TWB4/FormGroup.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public function __construct(
4545
$formKey = $id;
4646
}
4747

48+
// Ensure formKey is never null for LabelTag which requires string
49+
if ($formKey === null) {
50+
$formKey = 'formgroup_' . uniqid();
51+
}
52+
4853
$properties['class'] = 'form-group';
4954
parent::__construct(null, $properties);
5055
$this->addItem(new \Ease\Html\LabelTag($formKey, $label));

0 commit comments

Comments
 (0)