You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
328
+
if ($indicator = $reader->eatAny(array('@', '`', '|', '>'))) {
329
+
thrownewParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $indicator));
320
330
}
321
331
322
-
if ($output && '%' === $output[0]) {
323
-
@trigger_error(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output), E_USER_DEPRECATED);
332
+
if ($reader->eat('%')) {
333
+
@trigger_error(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output), E_USER_DEPRECATED);
324
334
}
325
335
326
336
if ($evaluate) {
@@ -331,36 +341,6 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, $str
331
341
return$output;
332
342
}
333
343
334
-
/**
335
-
* Parses a quoted scalar to YAML.
336
-
*
337
-
* @param string $scalar
338
-
* @param int &$i
339
-
*
340
-
* @return string A YAML string
341
-
*
342
-
* @throws ParseException When malformed inline YAML string is parsed
@trigger_error('The !!php/object tag to indicate dumped PHP objects is deprecated since version 3.1 and will be removed in 4.0. Use the !php/object tag instead.', E_USER_DEPRECATED);
thrownewParseException('Object support when parsing a YAML file has been disabled.');
552
+
}
553
+
554
+
return;
555
+
} elseif ($reader->eat('php/const:')) {
556
+
if (self::$constantSupport) {
557
+
$constant = $reader->readToFullConsumption();
558
+
if (defined($constant)) {
559
+
returnconstant($constant);
560
+
}
561
+
562
+
thrownewParseException(sprintf('The constant "%s" is not defined.', $constant));
563
+
}
564
+
if (self::$exceptionOnInvalidType) {
565
+
thrownewParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar));
thrownewParseException('Object support when parsing a YAML file has been disabled.');
582
-
}
583
-
584
-
return;
585
-
case0 === strpos($scalar, '!!php/object:'):
586
-
if (self::$objectSupport) {
587
-
@trigger_error('The !!php/object tag to indicate dumped PHP objects is deprecated since version 3.1 and will be removed in 4.0. Use the !php/object tag instead.', E_USER_DEPRECATED);
588
-
589
-
returnunserialize(substr($scalar, 13));
590
-
}
591
-
592
-
if (self::$exceptionOnInvalidType) {
593
-
thrownewParseException('Object sup
37CA
port when parsing a YAML file has been disabled.');
594
-
}
595
-
596
-
return;
597
-
case0 === strpos($scalar, '!php/const:'):
598
-
if (self::$constantSupport) {
599
-
if (defined($const = substr($scalar, 11))) {
600
-
returnconstant($const);
601
-
}
602
-
603
-
thrownewParseException(sprintf('The constant "%s" is not defined.', $const));
604
-
}
605
-
if (self::$exceptionOnInvalidType) {
606
-
thrownewParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar));
607
-
}
608
-
609
-
return;
610
-
case0 === strpos($scalar, '!!float '):
611
-
return (float) substr($scalar, 8);
612
591
casepreg_match('{^[+-]?[0-9][0-9_]*$}', $scalar):
613
592
$scalar = str_replace('_', '', (string) $scalar);
614
593
// omitting the break / return as integers are handled in the next case
0 commit comments