From c7ed20e9d831b6f73d58a7da5d22de6b4c85c576 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 21 Feb 2013 17:58:23 +0100 Subject: [PATCH] Fix minor issues in json code --- src/Composer/Json/JsonFile.php | 2 +- src/Composer/Json/JsonManipulator.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); }