Skip to content

Commit 0c7daa1

Browse files
committed
fixup! fix(lib) escape fieldname used to build form control
1 parent 7c7b6fc commit 0c7daa1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lizmap/modules/lizmap/lib/Form/QgisForm.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function __construct($layer, $form, $featureId, $loginFilteredOverride, A
123123
$formControl = new QgisFormControl($controlName, $fieldName, $formInfos[$fieldName], $prop, $defaultValue, $constraints, $this->appContext);
124124
} else {
125125
// The field is not present in the .XML
126-
$formControl = new QgisFormControl($controlName, $fieldName,null, $prop, null, $constraints, $this->appContext);
126+
$formControl = new QgisFormControl($controlName, $fieldName, null, $prop, null, $constraints, $this->appContext);
127127
}
128128

129129
$this->fillFormControl($formControl, $controlName, $form);
@@ -982,6 +982,7 @@ public function saveToDb($feature = null, $modifiedControls = array())
982982
$form = $this->form;
983983
foreach ($fields as $ref) {
984984
$controlName = self::escapeFieldName($ref);
985+
985986
/** @var null|\jFormsControl $jCtrl */
986987
$jCtrl = $form->getControl($controlName);
987988
// Field not in form
@@ -2002,9 +2003,7 @@ public static function escapeFieldName(string $fieldName)
20022003
$escapedFieldName = preg_replace('/\'/', '__escaped_quote__', $fieldName);
20032004
$escapedFieldName = preg_replace('/^action$/', '__escaped_action__', $escapedFieldName);
20042005
$escapedFieldName = preg_replace('/\?/', '__escaped_question__', $escapedFieldName);
2005-
$escapedFieldName = preg_replace('/ /', '__escaped_space__', $escapedFieldName);
20062006

2007-
return $escapedFieldName;
2007+
return preg_replace('/ /', '__escaped_space__', $escapedFieldName);
20082008
}
2009-
20102009
}

0 commit comments

Comments
 (0)