Merge branch '2.8' into 3.4
* 2.8: [appveyor] fix Revert "minor #28321 [Routing] Fixed the interface description of the url generator interface (Toflar)" remove cache warmers when Twig cache is disabled [HttpKernel][FrameworkBundle] Fix escaping of serialized payloads passed to test clients chore: rename Appveyor filename Fixed the interface description of the url generator interface Format file size in validation message according to binaryFormat option
This commit is contained in:
commit
5632dc7c7a
|
@ -53,7 +53,7 @@ install:
|
|||
- php composer.phar self-update
|
||||
- copy /Y .composer\* %APPDATA%\Composer\
|
||||
- php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
|
||||
- php .github/build-packages.php %APPVEYOR_REPO_COMMIT%^^ src\Symfony\Bridge\PhpUnit
|
||||
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit
|
||||
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
|
||||
- php composer.phar config platform.php 5.5.9
|
||||
- php composer.phar update --no-progress --no-suggest --ansi
|
|
@ -6,15 +6,20 @@ if (3 > $_SERVER['argc']) {
|
|||
}
|
||||
chdir(dirname(__DIR__));
|
||||
|
||||
$json = ltrim(file_get_contents('composer.json'));
|
||||
if ($json !== $package = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json)) {
|
||||
file_put_contents('composer.json', $package);
|
||||
}
|
||||
|
||||
$dirs = $_SERVER['argv'];
|
||||
array_shift($dirs);
|
||||
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
|
||||
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
|
||||
|
||||
$packages = array();
|
||||
$flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
|
||||
|
||||
foreach ($dirs as $k => $dir) {
|
||||
if (!system("git diff --name-only \"$mergeBase\" -- $dir", $exitStatus)) {
|
||||
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {
|
||||
if ($exitStatus) {
|
||||
exit($exitStatus);
|
||||
}
|
||||
|
@ -74,7 +79,6 @@ if ($dirs) {
|
|||
'type' => 'composer',
|
||||
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
|
||||
));
|
||||
$json = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json);
|
||||
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
|
||||
file_put_contents('composer.json', $json);
|
||||
}
|
||||
|
|
|
@ -161,8 +161,8 @@ class Client extends BaseClient
|
|||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = str_replace("'", "\\'", serialize($this->kernel));
|
||||
$request = str_replace("'", "\\'", serialize($request));
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
|
@ -171,7 +171,7 @@ class Client extends BaseClient
|
|||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class Client extends BaseClient
|
|||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$requires .= "require_once '".str_replace("'", "\\'", (new \ReflectionObject($this->kernel))->getFileName())."';\n";
|
||||
$requires .= 'require_once '.var_export((new \ReflectionObject($this->kernel))->getFileName(), true).";\n";
|
||||
|
||||
$profilerCode = '';
|
||||
if ($this->profiler) {
|
||||
|
@ -194,11 +194,11 @@ error_reporting($errorReporting);
|
|||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize('$kernel');
|
||||
\$kernel = unserialize($kernel);
|
||||
\$kernel->boot();
|
||||
$profilerCode
|
||||
|
||||
\$request = unserialize('$request');
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
|
|
|
@ -47,10 +47,15 @@ class ExtensionPass implements CompilerPassInterface
|
|||
$coreThemePath = \dirname(\dirname($reflClass->getFileName())).'/Resources/views/Form';
|
||||
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array($coreThemePath));
|
||||
|
||||
$paths = $container->getDefinition('twig.template_iterator')->getArgument(2);
|
||||
$paths[$coreThemePath] = null;
|
||||
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths);
|
||||
|
||||
if ($container->hasDefinition('twig.cache_warmer')) {
|
||||
$paths = $container->getDefinition('twig.cache_warmer')->getArgument(2);
|
||||
$paths[$coreThemePath] = null;
|
||||
$container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths);
|
||||
$container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths);
|
||||
}
|
||||
}
|
||||
|
||||
if ($container->has('router')) {
|
||||
|
|
|
@ -166,6 +166,11 @@ class TwigExtension extends Extension
|
|||
$container->registerForAutoconfiguration(LoaderInterface::class)->addTag('twig.loader');
|
||||
$container->registerForAutoconfiguration(RuntimeExtensionInterface::class)->addTag('twig.runtime');
|
||||
|
||||
if (false === $config['cache']) {
|
||||
$container->removeDefinition('twig.cache_warmer');
|
||||
$container->removeDefinition('twig.template_cache_warmer');
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID < 70000) {
|
||||
$this->addClassesToCompile(array(
|
||||
'Twig_Environment',
|
||||
|
|
|
@ -81,8 +81,9 @@ class Client extends BaseClient
|
|||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = str_replace("'", "\\'", serialize($this->kernel));
|
||||
$request = str_replace("'", "\\'", serialize($request));
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
|
@ -91,7 +92,7 @@ class Client extends BaseClient
|
|||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= "require_once '".str_replace("'", "\\'", $file)."';\n";
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,8 +108,8 @@ error_reporting($errorReporting);
|
|||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize('$kernel');
|
||||
\$request = unserialize('$request');
|
||||
\$kernel = unserialize($kernel);
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
|
|
|
@ -57,7 +57,7 @@ class FileValidator extends ConstraintValidator
|
|||
$binaryFormat = $constraint->binaryFormat;
|
||||
} else {
|
||||
$limitInBytes = $iniLimitSize;
|
||||
$binaryFormat = true;
|
||||
$binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat;
|
||||
}
|
||||
|
||||
list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat);
|
||||
|
|
|
@ -450,11 +450,17 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
|
|||
'{{ suffix }}' => 'bytes',
|
||||
), '1');
|
||||
|
||||
// access FileValidator::factorizeSizes() private method to format max file size
|
||||
$reflection = new \ReflectionClass(\get_class(new FileValidator()));
|
||||
$method = $reflection->getMethod('factorizeSizes');
|
||||
$method->setAccessible(true);
|
||||
list($sizeAsString, $limit, $suffix) = $method->invokeArgs(new FileValidator(), array(0, UploadedFile::getMaxFilesize(), false));
|
||||
|
||||
// it correctly parses the maxSize option and not only uses simple string comparison
|
||||
// 1000M should be bigger than the ini value
|
||||
$tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array(
|
||||
'{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576,
|
||||
'{{ suffix }}' => 'MiB',
|
||||
'{{ limit }}' => $limit,
|
||||
'{{ suffix }}' => $suffix,
|
||||
), '1000M');
|
||||
|
||||
// it correctly parses the maxSize option and not only uses simple string comparison
|
||||
|
|
Reference in New Issue