Преглед изворни кода

Fixed the json formatting when using JSONC

Christophe Coevoet пре 10 година
родитељ
комит
f3d8323a71
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/Composer/Json/JsonFile.php

+ 1 - 1
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)) {
+            if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || defined('JSON_C_VERSION')) {
                 $json = preg_replace('/\[\s+\]/', '[]', $json);
                 $json = preg_replace('/\{\s+\}/', '{}', $json);
             }