Commit d8f3cc35 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'master' into FixUnitTests

parents 256a3ddd 51a5ff12
......@@ -20,35 +20,33 @@ const NESTING_TOKEN_LENGTH = 17;
class BodytextParser {
/**
* @param $bodytext
* @param string $bodyText
*
* @return mixed|string
* @throws UserFormException
*/
public function process($bodytext) {
public function process($bodyText) {
$nestingOpen = '';
$nestingClose = '';
$bodytext = $this->trimAndRemoveCommentAndEmptyLine($bodytext, $nestingOpen, $nestingClose);
$bodyText = $this->trimAndRemoveCommentAndEmptyLine($bodyText, $nestingOpen, $nestingClose);
// Encrypt double curly braces to prevent false positives with nesting: form = {{form}}\n
$bodytext = Support::encryptDoubleCurlyBraces($bodytext);
$bodytext = $this->joinLine($bodytext, $nestingOpen, $nestingClose);
$bodyText = Support::encryptDoubleCurlyBraces($bodyText);
$bodyText = $this->joinLine($bodyText, $nestingOpen, $nestingClose);
$bodytext = $this->encryptNestingDelimeter($bodytext, $nestingOpen, $nestingClose);
$bodytext = $this->unNest($bodytext, $nestingOpen, $nestingClose);
$bodyText = $this->encryptNestingDelimeter($bodyText, $nestingOpen, $nestingClose);
$bodyText = $this->unNest($bodyText, $nestingOpen, $nestingClose);
$bodytext = $this->trimAndRemoveCommentAndEmptyLine($bodytext, $nestingOpen, $nestingClose);
$bodytext = Support::decryptDoubleCurlyBraces($bodytext);
$bodyText = $this->trimAndRemoveCommentAndEmptyLine($bodyText, $nestingOpen, $nestingClose);
$bodyText = Support::decryptDoubleCurlyBraces($bodyText);
if (strpos($bodytext, NESTING_TOKEN_OPEN) !== false) {
if (strpos($bodyText, NESTING_TOKEN_OPEN) !== false) {
throw new UserFormException(
json_encode([ERROR_MESSAGE_TO_USER => 'Report: Missing close delimiter', ERROR_MESSAGE_SUPPORT => $bodytext]), ERROR_MISSING_CLOSE_DELIMITER);
json_encode([ERROR_MESSAGE_TO_USER => 'Report: Missing close delimiter', ERROR_MESSAGE_SUPPORT => $bodyText]), ERROR_MISSING_CLOSE_DELIMITER);
}
return $bodytext;
return $bodyText;
}
/**
......
......@@ -383,7 +383,7 @@ class Store {
* Set or overwrite a complete store.
*
* @param array $dataArray
* @param $store
* @param string $store
* @param bool|false $flagOverwrite
*
* @throws UserFormException
......
......@@ -347,7 +347,7 @@ class EvaluateTest extends AbstractDatabaseTest {
// LDAP_ESCAPE_DN => array('\\', ',', '=', '+', '<', '>', ';', '"', '#'),
$this->store->setVar('a', ' hello world ', STORE_FORM, true);
// $this->assertEquals('\20hello world\20', $eval->substitute('a:F:all:L', $foundInStore));
$this->assertEquals(' hello world ', $eval->substitute('a:F:all:L', $foundInStore));
$this->assertEquals('\\20hello world\\20', $eval->substitute('a:F:all:L', $foundInStore));
$this->store->setVar('a', 'h\e,l=l+o< >w;o"r#ld', STORE_FORM, true);
$this->assertEquals('h\5ce\2cl\3dl\2bo\3c \3ew\3bo\22r\23ld', $eval->substitute('a:F:all:L', $foundInStore));
......@@ -355,7 +355,7 @@ class EvaluateTest extends AbstractDatabaseTest {
$this->store->setVar('a', ' hel;lo world ', STORE_FORM, true);
// $this->assertEquals('\20hel\3blo world\20', $eval->substitute('a:F:all:sL', $foundInStore));
$this->assertEquals(' hel\3blo world ', $eval->substitute('a:F:all:sL', $foundInStore));
$this->assertEquals('\20hel\3blo world\20', $eval->substitute('a:F:all:sL', $foundInStore));
}
......
......@@ -43,6 +43,12 @@ class QuickFormQueryTest extends TestCase {
//* @throws UserFormException
//*/
/**
* @throws CodeException
* @throws DbException
* @throws UserFormException
* @throws UserReportException
*/
public function testGetFormName() {
// <empty> bodytext
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment