Merge branch '2.3'

* 2.3:
  ErrorHandler and fixes
  fixed typo in CS translation (closes #8069)
  fix arab translation
  Removed reference to Symfony\Component\Form\Extension\Core\Type\FormType in form.xml
  slovenian validator translations updated
  [FrameworkBundle] set the dispatcher in the console application
  [Console] fix typehint for Application::setDispatcher
  [Finder] Fixed a path in a test.
  [Form] [Validator] Fixed post_max_size = 0 bug (Issue #8065)
This commit is contained in:
Fabien Potencier 2013-06-02 14:05:59 +02:00
commit f26c2b9deb
12 changed files with 127 additions and 15 deletions

View File

@ -67,6 +67,8 @@ class Application extends BaseApplication
{
$this->registerCommands();
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
if (true === $input->hasParameterOption(array('--shell', '-s'))) {
$shell = new Shell($this);
$shell->setProcessIsolation($input->hasParameterOption(array('--process-isolation')));

View File

@ -58,9 +58,6 @@
<service id="property_accessor" class="%property_accessor.class%" />
<!-- CoreExtension -->
<service id="form.type.field" class="Symfony\Component\Form\Extension\Core\Type\FieldType">
<tag name="form.type" alias="field" />
</service>
<service id="form.type.form" class="Symfony\Component\Form\Extension\Core\Type\FormType">
<argument type="service" id="property_accessor"/>
<tag name="form.type" alias="form" />

View File

@ -20,7 +20,7 @@ class ApplicationTest extends TestCase
{
public function testBundleInterfaceImplementation()
{
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\BundleInterface");
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
$kernel = $this->getKernel(array($bundle));
@ -30,7 +30,7 @@ class ApplicationTest extends TestCase
public function testBundleCommandsAreRegistered()
{
$bundle = $this->getMock("Symfony\Component\HttpKernel\Bundle\Bundle");
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\Bundle');
$bundle->expects($this->once())->method('registerCommands');
$kernel = $this->getKernel(array($bundle));
@ -41,12 +41,31 @@ class ApplicationTest extends TestCase
private function getKernel(array $bundles)
{
$kernel = $this->getMock("Symfony\Component\HttpKernel\KernelInterface");
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$dispatcher
->expects($this->atLeastOnce())
->method('dispatch')
;
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$container
->expects($this->once())
->method('get')
->with($this->equalTo('event_dispatcher'))
->will($this->returnValue($dispatcher))
;
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$kernel
->expects($this->any())
->method('getBundles')
->will($this->returnValue($bundles))
;
$kernel
->expects($this->any())
->method('getContainer')
->will($this->returnValue($container))
;
return $kernel;
}

View File

@ -33,7 +33,7 @@ use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* An Application is the container for a collection of commands.
@ -88,7 +88,7 @@ class Application
}
}
public function setDispatcher(EventDispatcher $dispatcher)
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Debug;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\ContextErrorException;
use Psr\Log\LoggerInterface;
/**
@ -89,9 +90,9 @@ class ErrorHandler
}
/**
* @throws \ErrorException When error_reporting returns error
* @throws ContextErrorException When error_reporting returns error
*/
public function handle($level, $message, $file, $line, $context)
public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
{
if (0 === $this->level) {
return false;
@ -118,7 +119,7 @@ class ErrorHandler
}
if ($this->displayErrors && error_reporting() & $level && $this->level & $level) {
throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line), 0, $level, $file, $line);
throw new ContextErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line), 0, $level, $file, $line, $context);
}
return false;

View File

@ -0,0 +1,36 @@
<?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\Debug\Exception;
/**
* Error Exception with Variable Context.
*
* @author Christian Sciberras <uuf6429@gmail.com>
*/
class ContextErrorException extends \ErrorException
{
private $context = array();
public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
{
parent::__construct($message, $code, $severity, $filename, $lineno);
$this->context = $context;
}
/**
* @return array Array of variables that existed when the exception occured
*/
public function getContext()
{
return $this->context;
}
}

View File

@ -808,7 +808,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$locations = array(
__DIR__.'/Fixtures/one',
self::$files[8],
self::$tmpDir.DIRECTORY_SEPARATOR.'toto',
);
$finder = new Finder();

View File

@ -121,7 +121,7 @@ class FormValidator extends ConstraintValidator
if ($form->isRoot() && null !== $length) {
$max = $this->serverParams->getPostMaxSize();
if (null !== $max && $length > $max) {
if (!empty($max) && $length > $max) {
$this->context->addViolation(
$config->getOption('post_max_size_message'),
array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),

View File

@ -660,6 +660,7 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase
array(1024, '1K', 0),
array(null, '1K', 0),
array(1024, '', 0),
array(1024, 0, 0),
);
}

View File

@ -4,7 +4,7 @@
<body>
<trans-unit id="1">
<source>This value should be false.</source>
<target>هذه القيمة يجب أن تكون كاذبة.</target>
<target>هذه القيمة يجب أن تكون خاطئة.</target>
</trans-unit>
<trans-unit id="2">
<source>This value should be true.</source>

View File

@ -180,7 +180,7 @@
</trans-unit>
<trans-unit id="48">
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
<target>Tato hodnota musí mít přesně {{ limit }} znak.|Tato hodnota musí mít přesně {{ limit }} znaky.|Tato hodnota musí mít přesně {{limit}} znaků.</target>
<target>Tato hodnota musí mít přesně {{ limit }} znak.|Tato hodnota musí mít přesně {{ limit }} znaky.|Tato hodnota musí mít přesně {{ limit }} znaků.</target>
</trans-unit>
<trans-unit id="49">
<source>The file was only partially uploaded.</source>

View File

@ -222,6 +222,62 @@
<source>Unsupported card type or invalid card number.</source>
<target>Nepodprti tip kartice ali neveljavna številka kartice.</target>
</trans-unit>
<trans-unit id="59">
<source>This is not a valid International Bank Account Number (IBAN).</source>
<target>Neveljavna mednarodna številka bančnega računa (IBAN).</target>
</trans-unit>
<trans-unit id="60">
<source>This value is not a valid ISBN-10.</source>
<target>Neveljavna vrednost po ISBN-10.</target>
</trans-unit>
<trans-unit id="61">
<source>This value is not a valid ISBN-13.</source>
<target>Neveljavna vrednost po ISBN-13.</target>
</trans-unit>
<trans-unit id="62">
<source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source>
<target>Neveljavna vrednost po ISBN-10 ali po ISBN-13.</target>
</trans-unit>
<trans-unit id="63">
<source>This value is not a valid ISSN.</source>
<target>Neveljavna vrednost ISSN.</target>
</trans-unit>
<trans-unit id="64">
<source>This value is not a valid currency.</source>
<target>Vrednost ni veljavna valuta.</target>
</trans-unit>
<trans-unit id="65">
<source>This value should be equal to {{ compared_value }}.</source>
<target>Vrednost mora biti enaka {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="66">
<source>This value should be greater than {{ compared_value }}.</source>
<target>Vrednost mora biti večja od {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="67">
<source>This value should be greater than or equal to {{ compared_value }}.</source>
<target>Vrednost mora biti večja ali enaka {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="68">
<source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Vrednost mora biti identična {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="69">
<source>This value should be less than {{ compared_value }}.</source>
<target>Vrednost mora biti manjša {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="70">
<source>This value should be less than or equal to {{ compared_value }}.</source>
<target>Vrednost mora biti manjša ali enaka {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="71">
<source>This value should not be equal to {{ compared_value }}.</source>
<target>Vrednost ne sme biti enaka {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="72">
<source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source>
<target>Vrednost ne sme biti identična {{ compared_value_type }} {{ compared_value }}.</target>
</trans-unit>
</body>
</file>
</xliff>