Merge branch '2.8' into 3.4
* 2.8: Remove duplicate condition fix useless space in docblock remove unneeded tearDown method [FrameworkBundle] Fix broken exception message Revert "fixed CS" Skip empty proxy code [Security] Fix "exclude-from-classmap" add missing double-quotes to extra_fields output message Convert InsufficientAuthenticationException to HttpException
This commit is contained in:
commit
faec03105f
@ -41,8 +41,8 @@ class ContainerAwareEventManager extends EventManager
|
||||
*
|
||||
* @param string $eventName The name of the event to dispatch. The name of the event is
|
||||
* the name of the method that is invoked on listeners.
|
||||
* @param EventArgs $eventArgs the event arguments to pass to the event handlers/listeners.
|
||||
* If not supplied, the single empty EventArgs instance is used
|
||||
* @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners.
|
||||
* If not supplied, the single empty EventArgs instance is used.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -195,7 +195,7 @@ EOF
|
||||
$currentName = $transPaths[0];
|
||||
|
||||
if (!is_dir($transPaths[0])) {
|
||||
throw new InvalidArgumentException(sprintf('<error>"%s" is neither an enabled bundle nor a directory.</error>', $transPaths[0]));
|
||||
throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,14 +309,13 @@ class Command
|
||||
|
||||
$this->definition->addOptions($this->application->getDefinition()->getOptions());
|
||||
|
||||
$this->applicationDefinitionMerged = true;
|
||||
|
||||
if ($mergeArgs) {
|
||||
$currentArguments = $this->definition->getArguments();
|
||||
$this->definition->setArguments($this->application->getDefinition()->getArguments());
|
||||
$this->definition->addArguments($currentArguments);
|
||||
}
|
||||
|
||||
$this->applicationDefinitionMerged = true;
|
||||
if ($mergeArgs) {
|
||||
$this->applicationDefinitionMergedWithArgs = true;
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,9 @@ EOF;
|
||||
$alreadyGenerated[$class] = true;
|
||||
// register class' reflector for resource tracking
|
||||
$this->container->getReflectionClass($class);
|
||||
$proxyCode = "\n".$proxyDumper->getProxyCode($definition);
|
||||
if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition)) {
|
||||
continue;
|
||||
}
|
||||
if ($strip) {
|
||||
$proxyCode = "<?php\n".$proxyCode;
|
||||
$proxyCode = substr(Kernel::stripComments($proxyCode), 5);
|
||||
|
@ -56,9 +56,9 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
||||
* @param string $eventName Event for which the listener is added
|
||||
* @param array $callback The service ID of the listener service & the method
|
||||
* name that has to be called
|
||||
* @param int $priority the higher this value, the earlier an event listener
|
||||
* @param int $priority The higher this value, the earlier an event listener
|
||||
* will be triggered in the chain.
|
||||
* Defaults to 0
|
||||
* Defaults to 0.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ class FormValidator extends ConstraintValidator
|
||||
if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) {
|
||||
$this->context->setConstraint($constraint);
|
||||
$this->context->buildViolation($config->getOption('extra_fields_message'))
|
||||
->setParameter('{{ extra_fields }}', implode('", "', array_keys($form->getExtraData())))
|
||||
->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"')
|
||||
->setInvalidValue($form->getExtraData())
|
||||
->setCode(Form::NO_SUCH_FIELD_ERROR)
|
||||
->addViolation();
|
||||
|
@ -257,10 +257,10 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
||||
*
|
||||
* Should be set to true only for root forms.
|
||||
*
|
||||
* @param bool $initialize true to initialize the form automatically,
|
||||
* @param bool $initialize True to initialize the form automatically,
|
||||
* false to suppress automatic initialization.
|
||||
* In the second case, you need to call
|
||||
* {@link FormInterface::initialize()} manually
|
||||
* {@link FormInterface::initialize()} manually.
|
||||
*
|
||||
* @return $this The configuration object
|
||||
*/
|
||||
|
@ -127,9 +127,9 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
||||
/**
|
||||
* Returns the normalized data of the field.
|
||||
*
|
||||
* @return mixed when the field is not submitted, the default data is returned.
|
||||
* @return mixed When the field is not submitted, the default data is returned.
|
||||
* When the field is submitted, the normalized submitted data is
|
||||
* returned if the field is valid, null otherwise
|
||||
* returned if the field is valid, null otherwise.
|
||||
*/
|
||||
public function getNormData();
|
||||
|
||||
|
@ -38,10 +38,10 @@ interface FormRendererEngineInterface
|
||||
* The type of the resource is decided by the implementation. The resource
|
||||
* is later passed to {@link renderBlock()} by the rendering algorithm.
|
||||
*
|
||||
* @param FormView $view the view for determining the used themes.
|
||||
* @param FormView $view The view for determining the used themes.
|
||||
* First the themes attached directly to the
|
||||
* view with {@link setTheme()} are considered,
|
||||
* then the ones of its parent etc
|
||||
* then the ones of its parent etc.
|
||||
* @param string $blockName The name of the block to render
|
||||
*
|
||||
* @return mixed the renderer resource or false, if none was found
|
||||
@ -70,10 +70,10 @@ interface FormRendererEngineInterface
|
||||
* The type of the resource is decided by the implementation. The resource
|
||||
* is later passed to {@link renderBlock()} by the rendering algorithm.
|
||||
*
|
||||
* @param FormView $view the view for determining the used themes.
|
||||
* @param FormView $view The view for determining the used themes.
|
||||
* First the themes attached directly to
|
||||
* the view with {@link setTheme()} are
|
||||
* considered, then the ones of its parent etc
|
||||
* considered, then the ones of its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with the root block
|
||||
* at the beginning
|
||||
* @param int $hierarchyLevel The level in the hierarchy at which to start
|
||||
@ -108,10 +108,10 @@ interface FormRendererEngineInterface
|
||||
* The type of the resource is decided by the implementation. The resource
|
||||
* is later passed to {@link renderBlock()} by the rendering algorithm.
|
||||
*
|
||||
* @param FormView $view the view for determining the used themes.
|
||||
* @param FormView $view The view for determining the used themes.
|
||||
* First the themes attached directly to
|
||||
* the view with {@link setTheme()} are
|
||||
* considered, then the ones of its parent etc
|
||||
* considered, then the ones of its parent etc.
|
||||
* @param array $blockNameHierarchy The block name hierarchy, with the root block
|
||||
* at the beginning
|
||||
* @param int $hierarchyLevel The level in the hierarchy at which to start
|
||||
|
@ -592,12 +592,33 @@ class FormValidatorTest extends ConstraintValidatorTestCase
|
||||
$this->validator->validate($form, new Form());
|
||||
|
||||
$this->buildViolation('Extra!')
|
||||
->setParameter('{{ extra_fields }}', 'foo')
|
||||
->setParameter('{{ extra_fields }}', '"foo"')
|
||||
->setInvalidValue(array('foo' => 'bar'))
|
||||
->setCode(Form::NO_SUCH_FIELD_ERROR)
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testViolationFormatIfMultipleExtraFields()
|
||||
{
|
||||
$form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
|
||||
->setCompound(true)
|
||||
->setDataMapper($this->getDataMapper())
|
||||
->add($this->getBuilder('child'))
|
||||
->getForm();
|
||||
|
||||
$form->submit(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'));
|
||||
|
||||
$this->expectNoValidate();
|
||||
|
||||
$this->validator->validate($form, new Form());
|
||||
|
||||
$this->buildViolation('Extra!')
|
||||
->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"')
|
||||
->setInvalidValue(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'))
|
||||
->setCode(Form::NO_SUCH_FIELD_ERROR)
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testNoViolationIfAllowExtraData()
|
||||
{
|
||||
$context = $this->getMockExecutionContext();
|
||||
|
@ -62,11 +62,11 @@ class OrderedHashMapIterator implements \Iterator
|
||||
* keys
|
||||
* @param array $orderedKeys The keys of the map in the order in which
|
||||
* they should be iterated
|
||||
* @param array $managedCursors an array from which to reference the
|
||||
* @param array $managedCursors An array from which to reference the
|
||||
* iterator's cursor as long as it is alive.
|
||||
* This array is managed by the corresponding
|
||||
* {@link OrderedHashMap} instance to support
|
||||
* recognizing the deletion of elements
|
||||
* recognizing the deletion of elements.
|
||||
*/
|
||||
public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ class AcceptHeaderItem
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns header value's string representation.
|
||||
* Returns header value's string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
|
||||
class NativeFileSessionHandler extends NativeSessionHandler
|
||||
{
|
||||
/**
|
||||
* @param string $savePath path of directory to save session files
|
||||
* @param string $savePath Path of directory to save session files
|
||||
* Default null will leave setting as defined by PHP.
|
||||
* '/path', 'N;/path', or 'N;octal-mode;/path
|
||||
*
|
||||
|
@ -506,9 +506,9 @@ class IntlDateFormatter
|
||||
/**
|
||||
* Set the formatter's timezone identifier.
|
||||
*
|
||||
* @param string $timeZoneId the time zone ID string of the time zone to use.
|
||||
* @param string $timeZoneId The time zone ID string of the time zone to use.
|
||||
* If NULL or the empty string, the default time zone for the
|
||||
* runtime is used
|
||||
* runtime is used.
|
||||
*
|
||||
* @return bool true on success or false on failure
|
||||
*
|
||||
|
@ -242,9 +242,9 @@ class NumberFormatter
|
||||
|
||||
/**
|
||||
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
|
||||
* @param int $style style of the formatting, one of the format style constants.
|
||||
* @param int $style Style of the formatting, one of the format style constants.
|
||||
* The only supported styles are NumberFormatter::DECIMAL
|
||||
* and NumberFormatter::CURRENCY
|
||||
* and NumberFormatter::CURRENCY.
|
||||
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
||||
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
||||
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
||||
@ -279,9 +279,9 @@ class NumberFormatter
|
||||
* Static constructor.
|
||||
*
|
||||
* @param string $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
|
||||
* @param int $style style of the formatting, one of the format style constants.
|
||||
* @param int $style Style of the formatting, one of the format style constants.
|
||||
* The only currently supported styles are NumberFormatter::DECIMAL
|
||||
* and NumberFormatter::CURRENCY
|
||||
* and NumberFormatter::CURRENCY.
|
||||
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
||||
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
||||
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
||||
@ -341,8 +341,8 @@ class NumberFormatter
|
||||
* Format a number.
|
||||
*
|
||||
* @param int|float $value The value to format
|
||||
* @param int $type type of the formatting, one of the format type constants.
|
||||
* Only type NumberFormatter::TYPE_DEFAULT is currently supported
|
||||
* @param int $type Type of the formatting, one of the format type constants.
|
||||
* Only type NumberFormatter::TYPE_DEFAULT is currently supported.
|
||||
*
|
||||
* @return bool|string The formatted value or false on error
|
||||
*
|
||||
@ -551,9 +551,9 @@ class NumberFormatter
|
||||
/**
|
||||
* Set an attribute.
|
||||
*
|
||||
* @param int $attr an attribute specifier, one of the numeric attribute constants.
|
||||
* @param int $attr An attribute specifier, one of the numeric attribute constants.
|
||||
* The only currently supported attributes are NumberFormatter::FRACTION_DIGITS,
|
||||
* NumberFormatter::GROUPING_USED and NumberFormatter::ROUNDING_MODE
|
||||
* NumberFormatter::GROUPING_USED and NumberFormatter::ROUNDING_MODE.
|
||||
* @param int $value The attribute value
|
||||
*
|
||||
* @return bool true on success or false on failure
|
||||
|
@ -143,12 +143,6 @@ class FormLoginAuthenticatorTest extends TestCase
|
||||
->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL)
|
||||
;
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->request = null;
|
||||
$this->requestWithSession = null;
|
||||
}
|
||||
}
|
||||
|
||||
class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator
|
||||
|
@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
||||
@ -176,7 +177,7 @@ class ExceptionListener
|
||||
private function startAuthentication(Request $request, AuthenticationException $authException)
|
||||
{
|
||||
if (null === $this->authenticationEntryPoint) {
|
||||
throw $authException;
|
||||
throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, array(), $authException->getCode());
|
||||
}
|
||||
|
||||
if (null !== $this->logger) {
|
||||
|
@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
@ -30,7 +31,7 @@ class ExceptionListenerTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getAuthenticationExceptionProvider
|
||||
*/
|
||||
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException = null)
|
||||
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException)
|
||||
{
|
||||
$event = $this->createEvent($exception);
|
||||
|
||||
@ -38,7 +39,7 @@ class ExceptionListenerTest extends TestCase
|
||||
$listener->onKernelException($event);
|
||||
|
||||
$this->assertNull($event->getResponse());
|
||||
$this->assertSame(null === $eventException ? $exception : $eventException, $event->getException());
|
||||
$this->assertEquals($eventException, $event->getException());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,11 +64,11 @@ class ExceptionListenerTest extends TestCase
|
||||
public function getAuthenticationExceptionProvider()
|
||||
{
|
||||
return array(
|
||||
array(new AuthenticationException()),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException()), $e),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), $e),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), $e),
|
||||
array(new AuthenticationException('random', 0, new \LogicException())),
|
||||
array($e = new AuthenticationException(), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException()), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
|
||||
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
|
||||
array($e = new AuthenticationException('random', 0, new \LogicException()), new HttpException(Response::HTTP_UNAUTHORIZED, 'random', $e, array(), 0)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,10 @@
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Security\\": "" },
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
"/Core/Tests/",
|
||||
"/Csrf/Tests/",
|
||||
"/Guard/Tests/",
|
||||
"/Http/Tests/"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
|
Reference in New Issue
Block a user