Fix handling of multilines in previous commit

main
Jordi Boggiano 11 years ago
parent 20ef3e3c5b
commit df7114869b

@ -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]).'$}',

@ -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'),
);
}
/**

Loading…
Cancel
Save