diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index 331ac680d..7e6b7d6c5 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/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]).'$}', diff --git a/tests/Composer/Test/Config/JsonConfigSourceTest.php b/tests/Composer/Test/Config/JsonConfigSourceTest.php index fc714c9bc..d0b78f3e3 100644 --- a/tests/Composer/Test/Config/JsonConfigSourceTest.php +++ b/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 - */ 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'), ); - } /**