Skip to content

Commit 4c1926d

Browse files
fix(RESTAPISettings): don't init models in choices callable #764
This commit addresses an issue where loading the RESTAPISettings `override_sensitive_fields` choices would loop through all model classes and allowed initialization of certain models, which could cause unexpected errors on Form pages. Going forward this callable will no longer allow models to automatically initialize.
1 parent 510fb47 commit 4c1926d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/RESTAPISettings.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class RESTAPISettings extends Model {
235235

236236
# Format choices so they include the class's verbose name as the choice's verbose name
237237
foreach (get_classes_from_namespace(namespace: '\\RESTAPI\\Models\\') as $model_class) {
238-
$model = new $model_class();
238+
$model = new $model_class(skip_init: true);
239239
foreach ($model->get_fields() as $field) {
240240
if ($model->$field->sensitive) {
241241
$choices[$model->get_class_shortname() . ':' . $field] =

0 commit comments

Comments
 (0)