-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] ParseException: pcre.backtrack_limit reached #22067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,7 +171,7 @@ public function parse($value, $flags = 0) | |
$this->refs[$isRef] = end($data); | ||
} | ||
} elseif ( | ||
self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|(?:![^\s]+\s+)?[^ \'"\[\{!].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) | ||
self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|(?:![^\s]++\s++)?[^ \'"\[\{!].*?) *\:(\s++(?P<value>.+))?$#u', $this->currentLine, $values) | ||
&& (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'"))) | ||
) { | ||
if ($context && 'sequence' == $context) { | ||
|
@@ -205,7 +205,7 @@ public function parse($value, $flags = 0) | |
$mergeNode = true; | ||
$allowOverwrite = true; | ||
if (isset($values['value']) && 0 === strpos($values['value'], '*')) { | ||
$refName = substr($values['value'], 1); | ||
$refName = substr(rtrim($values['value']), 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weren't they previously already, with this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it's legit then 👍 |
||
if (!array_key_exists($refName, $this->refs)) { | ||
throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine); | ||
} | ||
|
@@ -246,15 +246,15 @@ public function parse($value, $flags = 0) | |
$data += $parsed; // array union | ||
} | ||
} | ||
} elseif (isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) { | ||
} elseif (isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]++) *+(?P<value>.*)#u', $values['value'], $matches)) { | ||
$isRef = $matches['ref']; | ||
$values['value'] = $matches['value']; | ||
} | ||
|
||
$subTag = null; | ||
if ($mergeNode) { | ||
// Merge keys | ||
} elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#') || (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags))) { | ||
} elseif (!isset($values['value']) || '' === $values['value'] || 0 === strpos($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags))) { | ||
// hash | ||
// if next line is less indented or equal, then it means that the current value is null | ||
if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { | ||
|
@@ -286,7 +286,7 @@ public function parse($value, $flags = 0) | |
} | ||
} | ||
} else { | ||
$value = $this->parseValue($values['value'], $flags, $context); | ||
$value = $this->parseValue(rtrim($values['value']), $flags, $context); | ||
// Spec: Keys MUST be unique; first one wins. | ||
// But overwriting is allowed when a merge node is used in current block. | ||
if ($allowOverwrite || !isset($data[$key])) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GuilhemN the issue was the last part of the regexp, the related to the last
\s*
and the ungreedy quantifier just before.