@@ -119,7 +119,8 @@ public static function parseBlock($block)
119119 } elseif (preg_match ('/([^:]*): ?(.*)/ ' , $ line , $ match )) {
120120 $ key = $ match [1 ];
121121 $ 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
123124 if (isset ($ data [$ key ])) {
124125 $ data [$ key ] = (array ) $ data [$ key ];
125126 $ data [$ key ][] = $ value ;
@@ -136,8 +137,18 @@ public static function parseBlock($block)
136137
137138 /**
138139 * 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:'
141152 *
142153 * @param array $lines all lines of the block
143154 * @param int $n the 0-based index of the current line
@@ -150,6 +161,6 @@ protected static function lineContinues($lines, $n, $key)
150161 return
151162 in_array ($ key , ['FieldValue ' , 'FieldValueDefault ' ]) &&
152163 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 ]);
154165 }
155166}
0 commit comments