diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index db8ca7a5f..6568bad80 100755 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -195,7 +195,7 @@ class JsonFile $buffer = ''; $noescape = true; - for ($i = 0; $i <= $strLen; $i++) { + for ($i = 0; $i < $strLen; $i++) { // Grab the next character in the string $char = substr($json, $i, 1); diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index ba52a7867..4ed632a78 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -29,7 +29,7 @@ class JsonManipulator if (!preg_match('#^\{(.*)\}$#s', $contents)) { 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->detectIndenting(); }