Fix escaping check. Fixes #8

This commit is contained in:
Leonel Quinteros 2017-07-11 10:52:34 -03:00
parent 32b557a1e6
commit a24ca62c9e
2 changed files with 7 additions and 3 deletions

View File

@ -368,12 +368,12 @@ class Toml
$openLString = !$openLString;
}
}
elseif($toml[$i] == "\\" && !in_array($toml[$i+1], array('b', 't', 'n', 'f', 'r', 'u', 'U', '"', "\\", ' ')))
elseif($toml[$i] == "\\" && $toml[$i-1] != "\\" && !in_array($toml[$i+1], array('b', 't', 'n', 'f', 'r', 'u', 'U', '"', "\\", ' ')))
{
// Reserved special characters inside strings should produce error
if($openString)
{
throw new Exception('Reserved special characters inside strings are not allowed: ' . $toml[$i] . $toml[$i+1]);
throw new Exception('Reserved special characters inside strings are not allowed: ' . $toml[$i] . $toml[$i+1]);
}
// Cleanup escaped new lines and whitespaces from multi-line strings

View File

@ -244,4 +244,8 @@ color = "gray"
[[fruit.variety]]
name = "plantain"
[user.contributed.cases]
slashes="SERVER\\MASTER"