فهرست منبع

Fix handling of multilines in previous commit

Jordi Boggiano 12 سال پیش
والد
کامیت
df7114869b
2فایلهای تغییر یافته به همراه1 افزوده شده و 8 حذف شده
  1. 1 1
      src/Composer/Json/JsonManipulator.php
  2. 0 7
      tests/Composer/Test/Config/JsonConfigSourceTest.php

+ 1 - 1
src/Composer/Json/JsonManipulator.php

@@ -75,7 +75,7 @@ class JsonManipulator
             // addcslashes is used to double up backslashes since preg_replace resolves them as back references otherwise, see #1588
             $links = preg_replace('{"'.$packageRegex.'"(\s*:\s*)'.self::$JSON_STRING.'}i', addcslashes(JsonFile::encode($package).'${1}"'.$constraint.'"', '\\'), $links);
         } else {
-            if (preg_match('#^\s*\{\s*\S+.*?(\s*\}\s*)$#', $links, $match)) {
+            if (preg_match('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
                 // link missing but non empty links
                 $links = preg_replace(
                     '{'.preg_quote($match[1]).'$}',

+ 0 - 7
tests/Composer/Test/Config/JsonConfigSourceTest.php

@@ -16,11 +16,6 @@ use Composer\Config\JsonConfigSource;
 use Composer\Json\JsonFile;
 use Composer\Util\Filesystem;
 
-/**
- * JsonConfigSource Test
- *
- * @author Beau Simensen <beau@dflydev.com>
- */
 class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
 {
     private $workingDir;
@@ -68,7 +63,6 @@ class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
         $twoOfEverything = $this->fixturePath('composer-two-of-everything.json');
 
         return array(
-
             $this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-empty', $empty),
             $this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-oneOfEverything', $oneOfEverything),
             $this->addLinkDataArguments('require', 'my-vend/my-lib', '1.*', 'require-from-twoOfEverything', $twoOfEverything),
@@ -125,7 +119,6 @@ class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase
             $name,
             $after ?: $this->fixturePath('removeLink/'.$fixtureBasename.'-after.json'),
         );
-
     }
 
     /**