@@ -296,7 +296,7 @@ private static function dumpArray($value, $flags)
296
296
*
297
297
* @internal
298
298
*/
299
- public static function parseScalar ($ scalar , $ flags = 0 , $ delimiters = null , &$ i = 0 , $ evaluate = true , $ references = array ())
299
+ public static function parseScalar ($ scalar , $ flags = 0 , $ delimiters = null , &$ i = 0 , $ evaluate = true , $ references = array (), $ legacyOmittedKeySupport = false )
300
300
{
301
301
if (in_array ($ scalar [$ i ], array ('" ' , "' " ))) {
302
302
// quoted scalar
@@ -318,7 +318,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
318
318
if (preg_match ('/[ \t]+#/ ' , $ output , $ match , PREG_OFFSET_CAPTURE )) {
319
319
$ output = substr ($ output , 0 , $ match [0 ][1 ]);
320
320
}
321
- } elseif (preg_match ('/^(.* ?)( ' .implode ('| ' , $ delimiters ).')/ ' , substr ($ scalar , $ i ), $ match )) {
321
+ } elseif (preg_match ('/^(. ' .( $ legacyOmittedKeySupport ? ' + ' : ' * ' ). ' ?)( ' .implode ('| ' , $ delimiters ).')/ ' , substr ($ scalar , $ i ), $ match )) {
322
322
$ output = $ match [1 ];
323
323
$ i += strlen ($ output );
324
324
} else {
@@ -475,7 +475,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
475
475
}
476
476
477
477
// key
478
- $ key = self ::parseScalar ($ mapping , $ flags , array (': ' , ' ' ), $ i , false );
478
+ $ key = self ::parseScalar ($ mapping , $ flags , array (': ' , ' ' ), $ i , false , array (), true );
479
479
480
480
if (': ' !== $ key && false === $ i = strpos ($ mapping , ': ' , $ i )) {
481
481
break ;
0 commit comments