Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / yaml / Unescaper.php
index 1e02cc9fd808608015bab6843792ff9c53228afb..6e863e12f2ad498df43e48a1a517409f69bbcc3e 100644 (file)
@@ -11,6 +11,8 @@
 
 namespace Symfony\Component\Yaml;
 
+use Symfony\Component\Yaml\Exception\ParseException;
+
 /**
  * Unescaper encapsulates unescaping rules for single and double-quoted
  * YAML strings.
@@ -21,16 +23,6 @@ namespace Symfony\Component\Yaml;
  */
 class Unescaper
 {
-    /**
-     * Parser and Inline assume UTF-8 encoding, so escaped Unicode characters
-     * must be converted to that encoding.
-     *
-     * @deprecated since version 2.5, to be removed in 3.0
-     *
-     * @internal
-     */
-    const ENCODING = 'UTF-8';
-
     /**
      * Regex fragment that matches an escaped character in a double quoted string.
      */
@@ -57,9 +49,8 @@ class Unescaper
      */
     public function unescapeDoubleQuotedString($value)
     {
-        $self = $this;
-        $callback = function ($match) use ($self) {
-            return $self->unescapeCharacter($match[0]);
+        $callback = function ($match) {
+            return $this->unescapeCharacter($match[0]);
         };
 
         // evaluate the string
@@ -72,11 +63,8 @@ class Unescaper
      * @param string $value An escaped character
      *
      * @return string The unescaped character
-     *
-     * @internal This method is public to be usable as callback. It should not
-     *           be used in user code. Should be changed in 3.0.
      */
-    public function unescapeCharacter($value)
+    private function unescapeCharacter($value)
     {
         switch ($value[1]) {
             case '0':
@@ -126,9 +114,7 @@ class Unescaper
             case 'U':
                 return self::utf8chr(hexdec(substr($value, 2, 8)));
             default:
-                @trigger_error('Not escaping a backslash in a double-quoted string is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', E_USER_DEPRECATED);
-
-                return $value;
+                throw new ParseException(sprintf('Found unknown escape character "%s".', $value));
         }
     }