Merge branch '2.7' into 2.8
* 2.7: [HttpKernel] fixed a regression when no exception listeners are registered renamed some confusing tests propel/propel1 is now useless bumped Symfony version to 2.7.0 updated VERSION for 2.7.0-BETA1 updated CHANGELOG for 2.7.0-BETA1 [2.3] Fix @link annotations [2.7] For @link annotations [2.6] Fix @link annotations [2.7][Console] Count the array instead of [Config][cache factory] check type of callback argument. Fix javascript [2.3][Translation] test refresh cache when resources File change. Added deprecation message and original color back [Translator] Cache does not take fallback locales into consideration
This commit is contained in:
commit
222701f5e1
|
@ -0,0 +1,113 @@
|
|||
CHANGELOG for 2.7.x
|
||||
===================
|
||||
|
||||
This changelog references the relevant changes (bug and security fixes) done
|
||||
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.0-BETA1 (2015-04-10)
|
||||
|
||||
* feature #14229 [WebProfilerBundle] AJAX links (romqin)
|
||||
* feature #13220 [Console] Made output docopt compatible (WouterJ)
|
||||
* feature #14178 [Config] Delegate creation of ConfigCache instances to a factory. (mpdude)
|
||||
* feature #13443 [Translation][Command][FrameworkBundle] Enable translation debugging in directories (xelaris)
|
||||
* feature #14198 Automatically start server:run if server:start failed (WouterJ)
|
||||
* feature #13651 [Form][choice] added choice_translation_domain to avoid trans options. (aitboudad)
|
||||
* feature #14185 [Translation][Profiler]added the number of times a translation has been used. (aitboudad)
|
||||
* feature #13717 Deprecated precision option in favor of scale (WouterJ)
|
||||
* feature #14159 [Debug] Add symfony_debug_backtrace() and use it when dealing with fatal errors (jpauli, nicolas-grekas)
|
||||
* feature #14192 [HttpKernel] Embed the original exception as previous to bounced exceptions (nicolas-grekas)
|
||||
* feature #13626 [WebProfilerBundle] Added feedback about the current symfony version (WouterJ)
|
||||
* feature #13554 [TwigBundle] make date formats and number formats configurable (xabbuh)
|
||||
* feature #14196 Tweaked some console command styles (javiereguiluz)
|
||||
* feature #14181 [Debug] Updated the default log level when a PHP error occurs (lyrixx)
|
||||
* feature #14186 [Debug] Renamed "context" key to "scope_vars" to avoid any ambiguity (lyrixx)
|
||||
* feature #13942 [Translation] generate translation cache at warmup (xavierleune)
|
||||
* feature #14116 [FrameworkBundle] Move lint commands to lint namespace. (aitboudad)
|
||||
* feature #14052 [FrameworkBundle] added a protected shortcut getParameter() method in the base Controller class. (hhamon)
|
||||
* feature #14080 [VarDumper] Add casters for Reflection* classes (nicolas-grekas)
|
||||
* feature #14050 [Form] Refactored choice lists to support dynamic label, value, index and attribute generation (webmozart)
|
||||
* feature #14079 [VarDumper] Add and use Caster::PREFIX_* consts (nicolas-grekas)
|
||||
* feature #14057 [RFC][Console] Added console style guide helpers (v2) (kbond)
|
||||
* feature #14077 [VarDumper] Add VarDumperTestCase and related trait (nicolas-grekas)
|
||||
* feature #14058 [VarDumper] Add filters to casters (nicolas-grekas)
|
||||
* feature #14003 [Translation][Profiler] Added a Translation profiler. (aitboudad)
|
||||
* feature #14002 [Translation][Extractor] Allow extracting an array of files besides extracting a directory (marcosdsanchez)
|
||||
* feature #13438 [Console][Table] Add support for colspan/rowspan + multiple header lines (aitboudad)
|
||||
* feature #14071 [VarDumper] Ctrl+click toggles-all and fix IE8 support (larsborn, nicolas-grekas)
|
||||
* feature #13981 [Translation] merge all fallback catalogues messages into current catalo... (aitboudad)
|
||||
* feature #14006 [VarDumper] with-er interface for Cloner\Data (nicolas-grekas)
|
||||
* feature #14034 [VarDumper] add caster for MongoCursor objects (nicolas-grekas)
|
||||
* feature #14030 [DependencyInjection] make it possible to dump inlined services to XML (xabbuh)
|
||||
* feature #14016 Remove the API version in the validator component (saro0h, fabpot, stof)
|
||||
* feature #13960 [VarDumper] Add Caster for XML-parser resources (nicolas-grekas)
|
||||
* feature #13937 [FrameworkBundle] Allow to disable Kernel reboot (sroze)
|
||||
* feature #13892 [DependencyInjection] Improved yaml syntax (hason)
|
||||
* feature #14000 [SECURITY][ACL] fixed Base ACL exceptions on the RuntimeException (Neophy7e)
|
||||
* feature #14001 [Security] [ACL] Improved MaskBuilder and PermissionMap (AlexDpy)
|
||||
* feature #13959 [VarDumper] Add catch-all-objects hook for casters (nicolas-grekas)
|
||||
* feature #13980 [VarDumper] Added support for amqp (lyrixx)
|
||||
* feature #12818 [SecurityBundle] Added a command to encode a password (saro0h)
|
||||
* feature #13107 [FrameworkBundle] Serializer groups support (dunglas)
|
||||
* feature #13872 [FrameworkBundle] Added domain column when debugging translations (hiddewie)
|
||||
* feature #13780 [HttpKernel] Throw a LogicException when kernel.exception does not lead to a Response (nicolas-grekas)
|
||||
* feature #13897 [translation][performances] move loading resources into Translator initialize. (aitboudad)
|
||||
* feature #13864 Entity type: loader caching by query builder instance (dominikzogg)
|
||||
* feature #13855 Read validation contraints from Resources/config/validation/ sub-dir (GromNaN)
|
||||
* feature #13257 [Serializer] ObjectNormalizer (dunglas)
|
||||
* feature #13795 [Serializer] Refactoring of metadata (dunglas)
|
||||
* feature #13840 [WebProfilerBundle] Update ajax calls in toolbar to add the css error class (rubenrua)
|
||||
* feature #13809 [OptionsResolver] add missing deprecation triggers (Tobion)
|
||||
* feature #13398 [PhpUnit] new PhpUnit bridge (nicolas-grekas)
|
||||
* feature #13615 [FrameworkBundle] Made ServerParams a service (rpg600)
|
||||
* feature #12526 Add an auto_alias compiler pass (Daniel Wehner)
|
||||
* feature #13665 [Debug] generalize deprecated interfaces tracking (nicolas-grekas)
|
||||
* feature #13656 removed Propel bridge from Symfony Core (fabpot)
|
||||
* feature #13500 [Serializer] Normalizers can serialize collections and scalars (dunglas)
|
||||
* feature #13463 [WebProfilerBundle] Replaced raster PNG icons with vector SVG icons (sgrodzicki)
|
||||
* feature #13234 [Asset] added the component (fabpot)
|
||||
* feature #11379 Added new Forwarded header support for Request::getClientIps (tony-co)
|
||||
* feature #9782 [Security] added string representation for core Users (tobiassjosten)
|
||||
* feature #12174 [TwigBundle] Add loader priority (wizhippo)
|
||||
* feature #13074 [Translation] Refresh catalogues when resources change (iamluc)
|
||||
* feature #13294 [PropertyAccess] Show property path in all exception messages (mpajunen)
|
||||
* feature #13548 [TwigBridge] Added support for passing more files to twig:lint command (sustmi)
|
||||
* feature #13120 [Serializer] Name converter support (dunglas)
|
||||
* feature #13428 Added a Twig profiler (fabpot)
|
||||
* feature #11129 Added i18n support to ConfirmationQuestion (WouterJ)
|
||||
* feature #13034 [HttpKernel] [WebProfilerBundle] added HTTP status to profiler search result (xelaris)
|
||||
* feature #13475 [SecurityBundle] decouple the logout PHP helper and Twig extension (fabpot)
|
||||
* feature #12891 [Form] Deprecated setDefaultOptions() in favor of configureOptions() (peterrehm)
|
||||
* feature #13342 [security] Fetching current stored context when not explicitly specified (jaytaph)
|
||||
* feature #12960 [FrameworkBundle] Container parameters in Route#condition (nikita2206)
|
||||
* feature #13418 [DX] Attempt to improve logging messages with parameters (iltar)
|
||||
* feature #13320 [HttpKernel] Add request uri to Logger context (Rvanlaak)
|
||||
* feature #13401 [TwigBundle] use the new Twig autoescaping strategy (fabpot)
|
||||
* feature #13361 [Routing] apply deprecation triggers and fix tests (Tobion)
|
||||
* feature #13378 lazy-load fragment renderers (fabpot)
|
||||
* feature #13354 Twig decoupling from Templating (fabpot)
|
||||
* feature #13264 URL manipulations as a Twig extension (fabpot)
|
||||
* feature #13289 [DependencyInjection] deprecated synchronized services (fabpot)
|
||||
* feature #13323 [Security] removed usage of the deprecated SecurityContextInterface (fabpot)
|
||||
* feature #13241 [Form] add back model_timezone and view_timezone options (xabbuh)
|
||||
* feature #13252 [Serializer] Refactoring and object_to_populate support. (dunglas)
|
||||
* feature #13255 [Serializer] Add circular reference handling to the PropertyNormalizer (dunglas)
|
||||
* feature #13259 Deprecate the translator implementation in the Validator component (stof)
|
||||
* feature #12956 [Validator] Added checkDNS option on URL validator (saro0h)
|
||||
* feature #13230 [TwigBundle] removed the Container dependency on ActionsExtension (fabpot)
|
||||
* feature #12602 Add type aliases for allowed types in OptionsResolver (henrikbjorn)
|
||||
* feature #12594 [DX] [HttpKernel] Use "context" argument when logging route in RouterListener (iltar)
|
||||
* feature #12653 [Filesystem] Keep executable permission when a file is copied (joelwurtz)
|
||||
* feature #13164 [Debug] track and report deprecated classes and interfaces (nicolas-grekas)
|
||||
* feature #13157 [Security] Updated ACL generateSql.php (jaytaph)
|
||||
* feature #13105 [FrameworkBundle] added a test router for the built-in web server (fabpot)
|
||||
* feature #12092 [Serializer] Serialization groups support (dunglas)
|
||||
* feature #13031 [Serializer] Add xml_format_output context option. Close #12517. (dunglas)
|
||||
* feature #12862 [Console] Allowing the user answering key or value of the autocompleterValues (saro0h)
|
||||
* feature #12469 [Security] Added the triggering of the security.interactive_login event in SimplePreAuthenticationListener (saro0h)
|
||||
* feature #12896 [DX][Profiler] Show the inherited roles in the web profiler (peterrehm)
|
||||
* feature #12295 [FrameworkBundle] make GetSetMethodNormalizer available by default (dunglas)
|
||||
* feature #12666 [Hackday][Stopwatch] added __toString on StopwatchEvent (damienalexandre)
|
||||
|
|
@ -74,7 +74,6 @@
|
|||
"doctrine/orm": "~2.2,>=2.2.3",
|
||||
"doctrine/doctrine-bundle": "~1.2",
|
||||
"monolog/monolog": "~1.11",
|
||||
"propel/propel1": "~1.6",
|
||||
"ircmaxell/password-compat": "~1.0",
|
||||
"ocramius/proxy-manager": "~0.4|~1.0",
|
||||
"egulias/email-validator": "~1.2"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace Symfony\Bridge\Twig\Node;
|
||||
|
||||
/**
|
||||
* Compiles a call to {@link FormRendererInterface::renderBlock()}.
|
||||
* Compiles a call to {@link \Symfony\Component\Form\FormRendererInterface::renderBlock()}.
|
||||
*
|
||||
* The function name is used as block name. For example, if the function name
|
||||
* is "foo", the block "foo" will be rendered.
|
||||
|
|
|
@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Registers the file link format for the {@link DumpDataCollector}.
|
||||
* Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\DumpDataCollector}.
|
||||
*
|
||||
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Bundle\FrameworkBundle\Tests\Translation;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
|
||||
use Symfony\Component\Translation\Loader\ArrayLoader;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Translation\MessageSelector;
|
||||
|
@ -77,6 +78,8 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
// do it another time as the cache is primed now
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader->expects($this->never())->method('load');
|
||||
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
|
||||
$translator->setLocale('fr');
|
||||
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR', 'fr.UTF-8', 'sr@latin'));
|
||||
|
@ -90,6 +93,27 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('other choice 1 (PT-BR)', $translator->transChoice('other choice', 1));
|
||||
$this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
|
||||
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
|
||||
|
||||
// refresh cache again when resource file resources file change
|
||||
$resource = $this->getMock('Symfony\Component\Config\Resource\ResourceInterface');
|
||||
$resource
|
||||
->expects($this->at(0))
|
||||
->method('isFresh')
|
||||
->will($this->returnValue(false))
|
||||
;
|
||||
$catalogue = $this->getCatalogue('fr', array('foo' => 'foo fresh'));
|
||||
$catalogue->addResource($resource);
|
||||
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
$loader
|
||||
->expects($this->at(0))
|
||||
->method('load')
|
||||
->will($this->returnValue($catalogue))
|
||||
;
|
||||
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
|
||||
$translator->setLocale('fr');
|
||||
$this->assertEquals('foo fresh', $translator->trans('foo'));
|
||||
}
|
||||
|
||||
public function testTransWithCachingWithInvalidLocale()
|
||||
|
@ -227,12 +251,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function getTranslator($loader, $options = array(), $loaderFomat = 'loader', $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator')
|
||||
{
|
||||
$translator = new $translatorClass(
|
||||
$this->getContainer($loader),
|
||||
new MessageSelector(),
|
||||
array($loaderFomat => array($loaderFomat)),
|
||||
$options
|
||||
);
|
||||
$translator = $this->createTranslator($loader, $options, $translatorClass, $loaderFomat);
|
||||
|
||||
if ('loader' === $loaderFomat) {
|
||||
$translator->addResource('loader', 'foo', 'fr');
|
||||
|
@ -267,6 +286,16 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||
$translator->warmup($this->tmpDir);
|
||||
$this->assertTrue(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php'));
|
||||
}
|
||||
|
||||
private function createTranslator($loader, $options, $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator', $loaderFomat = 'loader')
|
||||
{
|
||||
return new $translatorClass(
|
||||
$this->getContainer($loader),
|
||||
new MessageSelector(),
|
||||
array($loaderFomat => array($loaderFomat)),
|
||||
$options
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TranslatorWithInvalidLocale extends Translator
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
{% set is_deprecation = log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
|
||||
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
|
||||
{% set log_loop_index = log_loop_index + 1 %}
|
||||
<li class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 %} warning{% endif %}">
|
||||
<li class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 or is_deprecation %} warning{% endif %}">
|
||||
{{ logger.display_message(loop.index, log, is_deprecation) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -114,6 +114,8 @@
|
|||
{% set stack = log.context.stack|default([]) %}
|
||||
{% set id = 'sf-call-stack-' ~ log_index %}
|
||||
|
||||
DEPRECATED - {{ log.message }}
|
||||
|
||||
{% if stack %}
|
||||
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
|
||||
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">
|
||||
|
|
|
@ -103,13 +103,13 @@
|
|||
return dict.hasOwnProperty(key)
|
||||
? dict[key]
|
||||
: null;
|
||||
}
|
||||
};
|
||||
|
||||
this.set = function(key, value) {
|
||||
dict[key] = value;
|
||||
|
||||
return value;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -383,7 +383,7 @@
|
|||
|
||||
return this;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function canvasAutoUpdateOnResizeAndSubmit(e) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
for (elem in menuItems) {
|
||||
if (typeof(menuItems[elem].children) !== 'undefined' &&
|
||||
menuItems[elem].children.length > 0) {
|
||||
child = menuItems[elem].children[0]
|
||||
child = menuItems[elem].children[0];
|
||||
|
||||
if ('' === child.getAttribute('title') ||
|
||||
null === child.getAttribute('title')) {
|
||||
|
|
|
@ -37,8 +37,11 @@ class ConfigCacheFactory implements ConfigCacheFactoryInterface
|
|||
*/
|
||||
public function cache($file, $callback)
|
||||
{
|
||||
$cache = new ConfigCache($file, $this->debug);
|
||||
if (!is_callable($callback)) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', gettype($callback)));
|
||||
}
|
||||
|
||||
$cache = new ConfigCache($file, $this->debug);
|
||||
if (!$cache->isFresh()) {
|
||||
call_user_func($callback, $cache);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Config\Tests;
|
||||
|
||||
use Symfony\Component\Config\ConfigCacheFactory;
|
||||
|
||||
class ConfigCacheFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Invalid type for callback argument. Expected callable, but got "object".
|
||||
*/
|
||||
public function testCachWithInvalidCallback()
|
||||
{
|
||||
$cacheFactory = new ConfigCacheFactory(true);
|
||||
|
||||
$cacheFactory->cache('file', new \stdClass());
|
||||
}
|
||||
}
|
|
@ -73,7 +73,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$message = OutputFormatter::escape($message);
|
||||
$lines = array_merge($lines, explode("\n", wordwrap($message, $this->lineLength - Helper::strlen($prefix))));
|
||||
|
||||
if (count($messages) > 1 && $key < count($message)) {
|
||||
if (count($messages) > 1 && $key < count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace Symfony\Component\Form\Extension\Core\ChoiceList;
|
||||
|
||||
use Symfony\Component\Form\ChoiceList\ChoiceListInterface as BaseChoiceListInterface;
|
||||
use Symfony\Component\Form\FormConfigBuilder;
|
||||
|
||||
/**
|
||||
* Contains choices that can be selected in a form field.
|
||||
|
@ -87,7 +88,7 @@ interface ChoiceListInterface extends BaseChoiceListInterface
|
|||
* Returns the indices corresponding to the given choices.
|
||||
*
|
||||
* The indices must be positive integers or strings accepted by
|
||||
* {@link FormConfigBuilder::validateName()}.
|
||||
* {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
|
||||
*
|
||||
* The index "placeholder" is internally reserved.
|
||||
*
|
||||
|
@ -107,7 +108,7 @@ interface ChoiceListInterface extends BaseChoiceListInterface
|
|||
* Returns the indices corresponding to the given values.
|
||||
*
|
||||
* The indices must be positive integers or strings accepted by
|
||||
* {@link FormConfigBuilder::validateName()}.
|
||||
* {@link \Symfony\Component\Form\FormConfigBuilder::validateName()}.
|
||||
*
|
||||
* The index "placeholder" is internally reserved.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
* Encapsulates common logic of {@link FormType} and {@link ButtonType}.
|
||||
*
|
||||
* This type does not appear in the form's type inheritance chain and as such
|
||||
* cannot be extended (via {@link FormTypeExtension}s) nor themed.
|
||||
* cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
||||
|
||||
/**
|
||||
* Data collector for {@link \Symfony\Component\Form\FormInterface} instances.
|
||||
* Data collector for {@link FormInterface} instances.
|
||||
*
|
||||
* @since 2.4
|
||||
* @author Robert Schönthal <robert.schoenthal@gmail.com>
|
||||
|
|
|
@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated since version 2.3, to be removed in 3.0.
|
||||
* Pass the Request instance to {@link Form::handleRequest()} instead.
|
||||
* Pass the Request instance to {@link \Symfony\Component\Form\Form::handleRequest()} instead.
|
||||
*/
|
||||
class BindRequestListener implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
|
|||
/**
|
||||
* Creates a new violation path from a string.
|
||||
*
|
||||
* @param string $violationPath The property path of a {@link ConstraintViolation}
|
||||
* @param string $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation}
|
||||
* object.
|
||||
*/
|
||||
public function __construct($violationPath)
|
||||
|
|
|
@ -159,7 +159,7 @@ class NativeRequestHandler implements RequestHandlerInterface
|
|||
* It's safe to pass an already converted array, in which case this method
|
||||
* just returns the original array unmodified.
|
||||
*
|
||||
* This method is identical to {@link Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
|
||||
* This method is identical to {@link \Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
|
||||
* and should be kept as such in order to port fixes quickly and easily.
|
||||
*
|
||||
* @param array $data
|
||||
|
|
|
@ -229,9 +229,13 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
|||
if (!$event->hasResponse()) {
|
||||
$this->finishRequest($request, $type);
|
||||
|
||||
if ($this->dispatcher->hasListeners(KernelEvents::EXCEPTION)) {
|
||||
throw new \LogicException('No listeners of the "kernel.exception" event set a Response', 0, $e);
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$response = $event->getResponse();
|
||||
|
||||
// the developer asked for a specific status code
|
||||
|
|
|
@ -102,8 +102,8 @@ class ContainerAwareHttpKernelTest extends \PHPUnit_Framework_TestCase
|
|||
$this->fail('->handle() suppresses the controller exception');
|
||||
} catch (\PHPUnit_Framework_Exception $exception) {
|
||||
throw $exception;
|
||||
} catch (\LogicException $actual) {
|
||||
$this->assertSame($expected, $actual->getPrevious(), '->handle() throws the controller exception, wrapped when no listener');
|
||||
} catch (\Exception $actual) {
|
||||
$this->assertSame($expected, $actual, '->handle() throws the controller exception');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,30 +23,27 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
|
|||
|
||||
class HttpKernelTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsTrue()
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue()
|
||||
{
|
||||
$exception = new \RuntimeException();
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () use ($exception) { throw $exception; }));
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
|
||||
|
||||
try {
|
||||
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
|
||||
$this->fail('LogicException expected');
|
||||
} catch (\LogicException $e) {
|
||||
$this->assertSame($exception, $e->getPrevious());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalseAndNoListenerIsRegistered()
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered()
|
||||
{
|
||||
$kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); }));
|
||||
|
||||
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false);
|
||||
}
|
||||
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse()
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
|
||||
|
@ -54,12 +51,31 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase
|
|||
});
|
||||
|
||||
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); }));
|
||||
$response = $kernel->handle(new Request());
|
||||
$response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
|
||||
|
||||
$this->assertEquals('500', $response->getStatusCode());
|
||||
$this->assertEquals('foo', $response->getContent());
|
||||
}
|
||||
|
||||
public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonHandlingListener()
|
||||
{
|
||||
$exception = new \RuntimeException();
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) {
|
||||
// should set a response, but does not
|
||||
});
|
||||
|
||||
$kernel = new HttpKernel($dispatcher, $this->getResolver(function () use($exception) { throw $exception; }));
|
||||
|
||||
try {
|
||||
$kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true);
|
||||
$this->fail('LogicException expected');
|
||||
} catch (\LogicException $e) {
|
||||
$this->assertSame($exception, $e->getPrevious());
|
||||
}
|
||||
}
|
||||
|
||||
public function testHandleExceptionWithARedirectionResponse()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Symfony\Component\OptionsResolver\Exception;
|
|||
|
||||
/**
|
||||
* Thrown when trying to read an option outside of or write it inside of
|
||||
* {@link Options::resolve()}.
|
||||
* {@link \Symfony\Component\OptionsResolver\Options::resolve()}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@ interface ClassMetadataFactoryInterface
|
|||
*
|
||||
* Otherwise, a new metadata instance is created. If the factory was
|
||||
* configured with a loader, the metadata is passed to the
|
||||
* {@link LoaderInterface::loadClassMetadata()} method for further
|
||||
* {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further
|
||||
* configuration. At last, the new object is returned.
|
||||
*
|
||||
* @param string|object $value
|
||||
|
|
|
@ -92,7 +92,7 @@ class DefaultTranslator implements TranslatorInterface
|
|||
* have the same expressiveness. While Translator supports intervals in
|
||||
* message translations, which are needed for languages other than English,
|
||||
* this translator does not. You should use Translator or a custom
|
||||
* implementation of {@link TranslatorInterface} if you need this or similar
|
||||
* implementation of {@link \Symfony\Component\Translation\TranslatorInterface} if you need this or similar
|
||||
* functionality.
|
||||
*
|
||||
* Example usage:
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace Symfony\Component\Validator\Mapping\Factory;
|
|||
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
|
||||
use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
|
||||
use Symfony\Component\Validator\Mapping\Loader\LoaderChain;
|
||||
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +30,7 @@ use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
|
|||
* Whenever a new metadata instance is created, it is passed to the loader,
|
||||
* which can configure the metadata based on configuration loaded from the
|
||||
* filesystem or a database. If you want to use multiple loaders, wrap them in a
|
||||
* {@link Loader\LoaderChain}.
|
||||
* {@link LoaderChain}.
|
||||
*
|
||||
* You can also optionally pass a {@link CacheInterface} instance to the
|
||||
* constructor. This cache will be used for persisting the generated metadata
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Validator\Mapping\Factory;
|
|||
use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactoryInterface;
|
||||
|
||||
/**
|
||||
* Returns {@link MetadataInterface} instances for values.
|
||||
* Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values.
|
||||
*
|
||||
* @since 2.5
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Symfony\Component\Validator;
|
|||
* @api
|
||||
*
|
||||
* @deprecated since version 2.5, to be removed in 3.0.
|
||||
* Use {@link Validator\ValidatorInterface} instead.
|
||||
* Use {@link \Symfony\Component\Validator\ValidatorInterface} instead.
|
||||
*/
|
||||
interface ValidatorInterface
|
||||
{
|
||||
|
|
Reference in New Issue