@@ -119,7 +119,8 @@ public static function parseBlock($block)
119
119
} elseif (preg_match ('/([^:]*): ?(.*)/ ' , $ line , $ match )) {
120
120
$ key = $ match [1 ];
121
121
$ value = $ match [2 ];
122
- // Convert multiple keys like 'FieldStateOption' to array
122
+ // Convert multiple keys like 'FieldStateOption' or 'FieldValue'
123
+ // from Choice fields to array
123
124
if (isset ($ data [$ key ])) {
124
125
$ data [$ key ] = (array ) $ data [$ key ];
125
126
$ data [$ key ][] = $ value ;
@@ -136,8 +137,18 @@ public static function parseBlock($block)
136
137
137
138
/**
138
139
* Checks whether the value for the given line number continues on the next
139
- * line. This is the case if the next line does not start with either
140
- * 'FieldValueDefault:' or 'FieldJustification:'.
140
+ * line, i.e. is a multiline string.
141
+ *
142
+ * This can be the case for 'FieldValue' and 'FieldValueDefault' keys. To
143
+ * find the end of the string we don't simply test for /^Field/, as this
144
+ * would also match multiline strings where a line starts with 'Field'.
145
+ *
146
+ * Instead we assume that the string is always followed by one of these
147
+ * keys:
148
+ *
149
+ * - 'FieldValue:'
150
+ * - 'FieldValueDefault:'
151
+ * - 'FieldJustification:'
141
152
*
142
153
* @param array $lines all lines of the block
143
154
* @param int $n the 0-based index of the current line
@@ -150,6 +161,6 @@ protected static function lineContinues($lines, $n, $key)
150
161
return
151
162
in_array ($ key , ['FieldValue ' , 'FieldValueDefault ' ]) &&
152
163
array_key_exists ($ n + 1 , $ lines ) &&
153
- !preg_match ('/^Field(ValueDefault|Justification):/ ' , $ lines [$ n + 1 ]);
164
+ !preg_match ('/^Field(Value| ValueDefault|Justification):/ ' , $ lines [$ n + 1 ]);
154
165
}
155
166
}
0 commit comments