Skip to content

Commit

Permalink
fix: resolve several other quote escaping problems
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Feb 5, 2019
1 parent dac1f25 commit 7e306f5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion inc/fields/checkboxesfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function serializeValue() {
return '';
}

return implode("\r\n", $this->value);
return implode("\r\n", Toolbox::addslashes_deep($this->value));
}

public function deserializeValue($value) {
Expand Down
1 change: 0 additions & 1 deletion inc/fields/descriptionfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function prepareQuestionInputForSave($input) {
ERROR);
return [];
}
$input['description'] = addslashes($input['description']);
}
$this->value = '';

Expand Down
6 changes: 3 additions & 3 deletions inc/fields/multiselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function serializeValue() {
return '';
}

return implode("\r\n", $this->value);
return implode("\r\n", Toolbox::addslashes_deep($this->value));
}

public function deserializeValue($value) {
Expand Down Expand Up @@ -178,7 +178,7 @@ public function getValueForTargetText($richText) {

foreach ($tab_values as $input) {
if (in_array($input, $values)) {
$value[] = Toolbox::addslashes_deep($input);
$value[] = $input;
}
}
if ($richText) {
Expand Down Expand Up @@ -222,7 +222,7 @@ public function parseAnswerValues($input) {
}
}

$this->value = $input[$key];
$this->value = Toolbox::stripslashes_deep($input[$key]);
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions inc/fields/selectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function parseAnswerValues($input) {
return false;
}

$this->value = $input[$key];
$this->value = Toolbox::stripslashes_deep($input[$key]);
return true;
}

Expand All @@ -96,7 +96,7 @@ public function serializeValue() {
return '';
}

return $this->value;
return Toolbox::addslashes_deep($this->value);
}

public function deserializeValue($value) {
Expand All @@ -114,7 +114,7 @@ public function getValueForDesign() {
}

public function getValueForTargetText($richText) {
return Toolbox::addslashes_deep($this->value);
return $this->value;
}

public function isValid() {
Expand Down
3 changes: 1 addition & 2 deletions inc/fields/textareafield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function serializeValue() {
return '';
}

return $this->value;
return Toolbox::addslashes_deep($this->value);
}

public function deserializeValue($value) {
Expand Down Expand Up @@ -143,4 +143,3 @@ public function isAnonymousFormCompatible() {
return true;
}
}

4 changes: 2 additions & 2 deletions tests/suite-unit/PluginFormcreatorDescriptionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function providerPrepareQuestionInputForSave() {
],
'expected' => [
'name' => "test d'apostrophe",
'description' => \Toolbox::addslashes_deep("test d'apostrophe"),
'description' => "test d'apostrophe",
],
'message' => 'A description field should have a description:',
],
Expand Down Expand Up @@ -99,4 +99,4 @@ public function testIsAnonymousFormCompatible() {
$output = $instance->isAnonymousFormCompatible();
$this->boolean($output)->isTrue();
}
}
}

0 comments on commit 7e306f5

Please sign in to comment.