Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
Fabien Potencier | 4d0899c5e3 | |
Fabien Potencier | 649bb0095f | |
Fabien Potencier | 20f9c87a12 | |
Fabien Potencier | 2636414523 | |
Fabien Potencier | 343865d847 | |
Nicolas Grekas | 789a34ad76 | |
Nicolas Grekas | 783ef2fb1d | |
Nicolas Grekas | 2681a5f4ba | |
Nicolas Grekas | 722efa1f17 | |
Fabien Potencier | 0848ce2c7f | |
Fabien Potencier | 95222d6f80 | |
Fabien Potencier | 161aa25779 |
|
@ -7,6 +7,18 @@ in 2.7 minor versions.
|
|||
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
||||
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1
|
||||
|
||||
* 2.7.51 (2019-04-17)
|
||||
|
||||
* security #cve-2019-10910 [DI] Check service IDs are valid (nicolas-grekas)
|
||||
* security #cve-2019-10909 [FrameworkBundle][Form] Fix XSS issues in the form theme of the PHP templating engine - CVE-2019-10909 (stof)
|
||||
* security #cve-2019-10911 [Security] Add a separator in the remember me cookie hash (pborreli)
|
||||
* security #cve-2019-10913 [HttpFoundation] reject invalid method override (nicolas-grekas)
|
||||
|
||||
* 2.7.50 (2018-12-06)
|
||||
|
||||
* security #cve-2018-19790 [Security\Http] detect bad redirect targets using backslashes (xabbuh)
|
||||
* security #cve-2018-19789 [Form] Filter file uploads out of regular form types (nicolas-grekas)
|
||||
|
||||
* 2.7.49 (2018-08-01)
|
||||
|
||||
* security #cve-2018-14774 [HttpKernel] fix trusted headers management in HttpCache and InlineFragmentRenderer (nicolas-grekas)
|
||||
|
|
|
@ -54,12 +54,13 @@ class ProxyDumper implements DumperInterface
|
|||
{
|
||||
$instantiation = 'return';
|
||||
|
||||
if (ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
|
||||
$instantiation .= " \$this->services['$id'] =";
|
||||
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
|
||||
$instantiation .= " \$this->services['$id'] = \$this->scopedServices['$scope']['$id'] =";
|
||||
if (ContainerInterface::SCOPE_CONTAINER === $scope = $definition->getScope()) {
|
||||
$instantiation .= ' $this->services[%s] =';
|
||||
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope()) {
|
||||
$instantiation .= ' $this->services[%s] = $this->scopedServices[%s][%1$s] =';
|
||||
}
|
||||
|
||||
$instantiation = sprintf($instantiation, var_export($id, true), var_export($scope, true));
|
||||
$methodName = 'get'.Container::camelize($id).'Service';
|
||||
$proxyClass = $this->getProxyClassName($definition);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<?php if (count($preferred_choices) > 0): ?>
|
||||
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
||||
<?php if (count($choices) > 0 && null !== $separator): ?>
|
||||
<option disabled="disabled"><?php echo $separator ?></option>
|
||||
<option disabled="disabled"><?php echo $view->escape($separator) ?></option>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $choices)) ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php if (count($errors) > 0): ?>
|
||||
<ul>
|
||||
<?php foreach ($errors as $error): ?>
|
||||
<li><?php echo $error->getMessage() ?></li>
|
||||
<li><?php echo $view->escape($error->getMessage()) ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php $method = strtoupper($method) ?>
|
||||
<?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?>
|
||||
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>" action="<?php echo $action ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
|
||||
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>" action="<?php echo $view->escape($action) ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
|
||||
<?php if ($form_method !== $method): ?>
|
||||
<input type="hidden" name="_method" value="<?php echo $method ?>" />
|
||||
<input type="hidden" name="_method" value="<?php echo $view->escape($method) ?>" />
|
||||
<?php endif ?>
|
||||
|
|
|
@ -622,6 +622,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
{
|
||||
$alias = strtolower($alias);
|
||||
|
||||
if ('' === $alias || '\\' === substr($alias, -1) || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias));
|
||||
}
|
||||
|
||||
if (is_string($id)) {
|
||||
$id = new Alias($id);
|
||||
} elseif (!$id instanceof Alias) {
|
||||
|
@ -756,6 +760,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
|
||||
$id = strtolower($id);
|
||||
|
||||
if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
|
||||
}
|
||||
|
||||
unset($this->aliasDefinitions[$id]);
|
||||
|
||||
return $this->definitions[$id] = $definition;
|
||||
|
|
|
@ -377,9 +377,9 @@ class PhpDumper extends Dumper
|
|||
$instantiation = '';
|
||||
|
||||
if (!$isProxyCandidate && ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
|
||||
$instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance');
|
||||
$instantiation = sprintf('$this->services[%s] = %s', var_export($id, true), $simple ? '' : '$instance');
|
||||
} elseif (!$isProxyCandidate && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
|
||||
$instantiation = "\$this->services['$id'] = \$this->scopedServices['$scope']['$id'] = ".($simple ? '' : '$instance');
|
||||
$instantiation = sprintf('$this->services[%s] = $this->scopedServices[%s][%1$s] = %s', var_export($id, true), var_export($scope, true), $simple ? '' : '$instance');
|
||||
} elseif (!$simple) {
|
||||
$instantiation = '$instance';
|
||||
}
|
||||
|
@ -598,6 +598,9 @@ class PhpDumper extends Dumper
|
|||
* Gets the $public '$id'$shared service.
|
||||
*
|
||||
* $return
|
||||
EOF;
|
||||
$code = str_replace('*/', ' ', $code).<<<EOF
|
||||
|
||||
*/
|
||||
{$visibility} function get{$this->camelize($id)}Service($lazyInitialization)
|
||||
{
|
||||
|
@ -609,7 +612,7 @@ EOF;
|
|||
if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) {
|
||||
$code .= <<<EOF
|
||||
if (!isset(\$this->scopedServices['$scope'])) {
|
||||
throw new InactiveScopeException('$id', '$scope');
|
||||
throw new InactiveScopeException({$this->export($id)}, '$scope');
|
||||
}
|
||||
|
||||
|
||||
|
@ -617,7 +620,7 @@ EOF;
|
|||
}
|
||||
|
||||
if ($definition->isSynthetic()) {
|
||||
$code .= sprintf(" throw new RuntimeException('You have requested a synthetic service (\"%s\"). The DIC does not know how to construct this service.');\n }\n", $id);
|
||||
$code .= sprintf(" throw new RuntimeException(%s);\n }\n", var_export("You have requested a synthetic service (\"$id\"). The DIC does not know how to construct this service.", true));
|
||||
} else {
|
||||
$code .=
|
||||
$this->addServiceInclude($definition).
|
||||
|
@ -691,10 +694,11 @@ EOF;
|
|||
$arguments[] = $this->dumpValue($value);
|
||||
}
|
||||
|
||||
$call = $this->wrapServiceConditionals($call[1], sprintf("\$this->get('%s')->%s(%s);", $definitionId, $call[0], implode(', ', $arguments)));
|
||||
$definitionId = var_export($definitionId, true);
|
||||
$call = $this->wrapServiceConditionals($call[1], sprintf('$this->get(%s)->%s(%s);', $definitionId, $call[0], implode(', ', $arguments)));
|
||||
|
||||
$code .= <<<EOF
|
||||
if (\$this->initialized('$definitionId')) {
|
||||
if (\$this->initialized($definitionId)) {
|
||||
$call
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1131,7 @@ EOF;
|
|||
|
||||
$conditions = array();
|
||||
foreach ($services as $service) {
|
||||
$conditions[] = sprintf("\$this->has('%s')", $service);
|
||||
$conditions[] = sprintf('$this->has(%s)', var_export($service, true));
|
||||
}
|
||||
|
||||
// re-indent the wrapped code
|
||||
|
@ -1404,11 +1408,13 @@ EOF;
|
|||
*/
|
||||
public function dumpParameter($name)
|
||||
{
|
||||
$name = (string) $name;
|
||||
|
||||
if ($this->container->isFrozen() && $this->container->hasParameter($name)) {
|
||||
return $this->dumpValue($this->container->getParameter($name), false);
|
||||
}
|
||||
|
||||
return sprintf("\$this->getParameter('%s')", strtolower($name));
|
||||
return sprintf('$this->getParameter(%s)', var_export($name, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1443,10 +1449,10 @@ EOF;
|
|||
}
|
||||
|
||||
if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
|
||||
return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
|
||||
return sprintf('$this->get(%s, ContainerInterface::NULL_ON_INVALID_REFERENCE)', var_export($id, true));
|
||||
}
|
||||
|
||||
return sprintf('$this->get(\'%s\')', $id);
|
||||
return sprintf('$this->get(%s)', var_export($id, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,6 +111,38 @@ class ContainerBuilderTest extends TestCase
|
|||
$this->assertSame($builder->get('bar'), $builder->get('bar'), '->get() always returns the same instance if the service is shared');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
* @dataProvider provideBadId
|
||||
*/
|
||||
public function testBadAliasId($id)
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->setAlias($id, 'foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
* @dataProvider provideBadId
|
||||
*/
|
||||
public function testBadDefinitionId($id)
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->setDefinition($id, new Definition('Foo'));
|
||||
}
|
||||
|
||||
public function provideBadId()
|
||||
{
|
||||
return [
|
||||
[''],
|
||||
["\0"],
|
||||
["\r"],
|
||||
["\n"],
|
||||
["'"],
|
||||
['ab\\'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage You have requested a synthetic service ("foo"). The DIC does not know how to construct this service.
|
||||
|
|
|
@ -1290,19 +1290,37 @@ class Request
|
|||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
if (null === $this->method) {
|
||||
$this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
|
||||
|
||||
if ('POST' === $this->method) {
|
||||
if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) {
|
||||
$this->method = strtoupper($method);
|
||||
} elseif (self::$httpMethodParameterOverride) {
|
||||
$this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST')));
|
||||
}
|
||||
}
|
||||
if (null !== $this->method) {
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
return $this->method;
|
||||
$this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
|
||||
|
||||
if ('POST' !== $this->method) {
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
$method = $this->headers->get('X-HTTP-METHOD-OVERRIDE');
|
||||
|
||||
if (!$method && self::$httpMethodParameterOverride) {
|
||||
$method = $this->request->get('_method', $this->query->get('_method', 'POST'));
|
||||
}
|
||||
|
||||
if (!\is_string($method)) {
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
$method = strtoupper($method);
|
||||
|
||||
if (\in_array($method, array('GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'), true)) {
|
||||
return $this->method = $method;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[A-Z]++$/D', $method)) {
|
||||
throw new \UnexpectedValueException(sprintf('Invalid method override "%s".', $method));
|
||||
}
|
||||
|
||||
return $this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,11 +58,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||
protected $startTime;
|
||||
protected $loadClassCache;
|
||||
|
||||
const VERSION = '2.7.49';
|
||||
const VERSION_ID = 20749;
|
||||
const VERSION = '2.7.52';
|
||||
const VERSION_ID = 20752;
|
||||
const MAJOR_VERSION = 2;
|
||||
const MINOR_VERSION = 7;
|
||||
const RELEASE_VERSION = 49;
|
||||
const RELEASE_VERSION = 52;
|
||||
const EXTRA_VERSION = '';
|
||||
|
||||
const END_OF_MAINTENANCE = '05/2018';
|
||||
|
|
|
@ -121,6 +121,6 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
|||
*/
|
||||
protected function generateCookieHash($class, $username, $expires, $password)
|
||||
{
|
||||
return hash_hmac('sha256', $class.$username.$expires.$password, $this->getKey());
|
||||
return hash_hmac('sha256', $class.self::COOKIE_DELIMITER.$username.self::COOKIE_DELIMITER.$expires.self::COOKIE_DELIMITER.$password, $this->getKey());
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue