@@ -212,7 +212,11 @@ private function parseStatement($child)
212212 }
213213 $ arrayAttr = $ argsElement [0 ]->getAttribute (self ::ATTR_ARRAY );
214214 if (is_null ($ arrayAttr )) {
215- $ argsElement [0 ]->addAttribute (self ::ATTR_ARRAY , self ::ATTR_ARRAY_NUMERIC );
215+ if ($ argsElement [0 ]->count ()) {
216+ $ argsElement [0 ]->addAttribute (self ::ATTR_ARRAY , self ::ATTR_ARRAY_NUMERIC );
217+ } else {
218+ $ argsElement [0 ]->addAttribute (self ::ATTR_ARRAY , self ::ATTR_ARRAY_STRING );
219+ }
216220 }
217221
218222 $ attributes = $ argsElement [0 ]->parseChildren ();
@@ -229,7 +233,7 @@ private function parseStatement($child)
229233 */
230234 private function parseChildren ()
231235 {
232- $ arrayType = $ this ->getAttribute (self ::ATTR_ARRAY , self :: ATTR_ARRAY_ASSOCIATIVE );
236+ $ arrayType = $ this ->getAttribute (self ::ATTR_ARRAY );
233237 $ space = (string ) $ this ->getAttribute (self ::ATTR_SPACE );
234238 if ($ space !== self ::ATTR_SPACE_PRESERVE and ! empty ($ space )) {
235239 throw new Nette \InvalidStateException ("Attribute " . self ::ATTR_SPACE . " has an unknown value ' $ space' " );
@@ -241,7 +245,11 @@ private function parseChildren()
241245 return $ res ;
242246 }
243247
244- if (!$ this ->count ()) {
248+ if ($ arrayType === NULL && $ this ->count ()) {
249+ $ arrayType = self ::ATTR_ARRAY_ASSOCIATIVE ;
250+ }
251+
252+ if ($ arrayType === NULL ) {
245253 $ res = $ this ->getValue ();
246254 $ this ->trim ($ res , $ space );
247255 return $ res ;
0 commit comments