From c571ccafd3daf39d980cc1159c035d6a6df8ddd0 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 18 Nov 2014 11:37:26 +0100 Subject: [PATCH] Restrict the JSONC fix to affected versions --- 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 e008ced9d..0611075e5 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -187,7 +187,7 @@ class JsonFile $json = json_encode($data, $options); // compact brackets to follow recent php versions - if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || defined('JSON_C_VERSION')) { + if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(php_version('json'), '1.3.6', '<'))) { $json = preg_replace('/\[\s+\]/', '[]', $json); $json = preg_replace('/\{\s+\}/', '{}', $json); }