1
0
Fork 0

Fix minor issues in json code

pull/1609/head
Jordi Boggiano 2013-02-21 17:58:23 +01:00
parent 5f48d5277d
commit c7ed20e9d8
2 changed files with 2 additions and 2 deletions

View File

@ -195,7 +195,7 @@ class JsonFile
$buffer = ''; $buffer = '';
$noescape = true; $noescape = true;
for ($i = 0; $i <= $strLen; $i++) { for ($i = 0; $i < $strLen; $i++) {
// Grab the next character in the string // Grab the next character in the string
$char = substr($json, $i, 1); $char = substr($json, $i, 1);

View File

@ -29,7 +29,7 @@ class JsonManipulator
if (!preg_match('#^\{(.*)\}$#s', $contents)) { if (!preg_match('#^\{(.*)\}$#s', $contents)) {
throw new \InvalidArgumentException('The json file must be an object ({})'); throw new \InvalidArgumentException('The json file must be an object ({})');
} }
$this->newline = false !== strpos("\r\n", $contents) ? "\r\n": "\n"; $this->newline = false !== strpos($contents, "\r\n") ? "\r\n": "\n";
$this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents; $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
$this->detectIndenting(); $this->detectIndenting();
} }