From 293c45fabee5d9e780d88d42f710b7575b6b6d6e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 5 Nov 2011 23:53:20 +0100 Subject: [PATCH] Fix unescaped backslash issue --- src/Composer/Json/JsonFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 743eb011b..945410c24 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -124,7 +124,7 @@ class JsonFile $charOffset = 0; if (preg_match('#["}\]]\s*(,)\s*[}\]]#', $json, $match, PREG_OFFSET_CAPTURE)) { $msg .= ', extra comma'; - } elseif (preg_match('#(\\\\(?!["\\/bfnrt]|u[a-f0-9]{4}))#i', $json, $match, PREG_OFFSET_CAPTURE)) { + } elseif (preg_match('#((?<=[^\\\\])\\\\(?!["\\\\/bfnrt]|u[a-f0-9]{4}))#i', $json, $match, PREG_OFFSET_CAPTURE)) { $msg .= ', unescaped backslash (\\)'; } elseif (preg_match('#(["}\]]) *\r?\n *"#', $json, $match, PREG_OFFSET_CAPTURE)) { $msg .= ', missing comma';