Merge branch '2.4'

* 2.4:
  [Debug] fixed tests
  ErrorHandlerTest: restore_error_handler() on assertion failure
  Fixed typo
  [validator] throw an exception if isn't an instance of ConstraintValidatorInterface.
  Reset the box model to content-box in the web debug toolbar
  [FrameworkBundle] Allowed "0" as a checkbox value in the php template.
  raising delta on stopwatch as travis really breaks with less than 35
  Switched to correct gender of "Token"
  bumped Symfony version to 2.4.1
  updated VERSION for 2.4.0
  updated CHANGELOG for 2.4.0
  fixed typos in several translations
  [HttpKernel] use static late binding when dumping out container

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
This commit is contained in:
Fabien Potencier 2013-12-12 17:07:18 +01:00
commit de5790314d
21 changed files with 146 additions and 85 deletions

View File

@ -7,6 +7,28 @@ in 2.4 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.4.0...v2.4.1
* 2.4.0 (2013-12-03)
* bug #9673 Fixed BC break in csrf protection (WouterJ)
* bug #9665 [Bridge/Doctrine] ORMQueryBuilderLoader - handled the scenario when no entity manager is passed with closure query builder (jakzal)
* bug #9662 [FrameworkBundle] Enabled csrf_protection by default if form.csrf_protection is enabled (bschussek)
* bug #9656 [DoctrineBridge] normalized class names in the ORM type guesser (fabpot)
* bug #9647 use the correct class name to retrieve mapped class' metadata and reposi... (xabbuh)
* bug #9648 [Debug] ensured that a fatal PHP error is actually fatal after being handled by our error handler (fabpot)
* bug #9643 [WebProfilerBundle] Fixed js escaping in time.html.twig (hason)
* bug #9641 [Debug] Avoid notice from being "eaten" by fatal error. (fabpot)
* bug #9639 Modified guessDefaultEscapingStrategy to not escape txt templates (fabpot)
* bug #9314 [Form] Fix DateType for 32bits computers. (WedgeSama)
* bug #9443 [FrameworkBundle] Fixed the registration of validation.xml file when the form is disabled (hason)
* bug #9625 [HttpFoundation] Do not return an empty session id if the session was closed (Taluu)
* bug #9621 [ExpressionLanguage] fixed lexing expression ending with spaces (fabpot)
* bug #9637 [Validator] Replaced inexistent interface (jakzal)
* bug #9628 [HttpKernel] Fix profiler event-listener usage outside request stack context (romainneutron)
* bug #9624 [Console] Fix undefined offset when formatting namespace suggestions (GromNaN)
* bug #9605 Adjusting CacheClear Warmup method to namespaced kernels (rdohms)
* bug #9617 [HttpKernel] Http kernel regression fix (hhamon)
* bug #9610 Container::camelize also takes backslashes into consideration (ondrejmirtes)
* 2.4.0-RC1 (2013-11-25)
* bug #9607 [HttpKernel] Fix a bug when using the kernel property in overridden method Client::setServerParameters() (gnutix)

View File

@ -1,5 +1,5 @@
<input type="checkbox"
<?php echo $view['form']->block($form, 'widget_attributes') ?>
<?php if ($value): ?> value="<?php echo $view->escape($value) ?>"<?php endif ?>
<?php if (strlen($value) > 0): ?> value="<?php echo $view->escape($value) ?>"<?php endif ?>
<?php if ($checked): ?> checked="checked"<?php endif ?>
/>

View File

@ -43,7 +43,7 @@ class ConstraintValidatorFactoryTest extends \PHPUnit_Framework_TestCase
{
$service = 'validator_constraint_service';
$alias = 'validator_constraint_alias';
$validator = new \stdClass();
$validator = $this->getMockForAbstractClass('Symfony\\Component\\Validator\\ConstraintValidator');
// mock ContainerBuilder b/c it implements TaggedContainerInterface
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');

View File

@ -14,7 +14,8 @@ namespace Symfony\Bundle\FrameworkBundle\Validator;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
/**
* Uses a service container to create constraint validators.
@ -58,7 +59,9 @@ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
*
* @param Constraint $constraint A constraint
*
* @return ConstraintValidator A validator for the supplied constraint
* @return ConstraintValidatorInterface A validator for the supplied constraint
*
* @throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface
*/
public function getInstance(Constraint $constraint)
{
@ -70,6 +73,10 @@ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
$this->validators[$name] = $this->container->get($this->validators[$name]);
}
if (!$this->validators[$name] instanceof ConstraintValidatorInterface) {
throw new UnexpectedTypeException($this->validators[$name], 'Symfony\Component\Validator\ConstraintValidatorInterface');
}
return $this->validators[$name];
}
}

View File

@ -18,6 +18,12 @@
z-index: 6000000;
}
.sf-toolbarreset * {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.sf-toolbarreset {
position: fixed;
background-color: #f7f7f7;

View File

@ -90,6 +90,11 @@ PHP
);
} catch (DummyException $e) {
// if an exception is thrown, the test passed
} catch (\Exception $e) {
restore_error_handler();
restore_exception_handler();
throw $e;
}
restore_error_handler();
@ -105,7 +110,7 @@ PHP
$exceptionCheck = function($exception) use ($that) {
$that->assertInstanceOf('Symfony\Component\Debug\Exception\ContextErrorException', $exception);
$that->assertEquals(E_NOTICE, $exception->getSeverity());
$that->assertEquals(__LINE__ + 40, $exception->getLine());
$that->assertEquals(__LINE__ + 44, $exception->getLine());
$that->assertEquals(__FILE__, $exception->getFile());
$that->assertRegexp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
$that->assertArrayHasKey('foobar', $exception->getContext());
@ -135,6 +140,10 @@ PHP
self::triggerNotice($this);
} catch (DummyException $e) {
// if an exception is thrown, the test passed
} catch (\Exception $e) {
restore_error_handler();
throw $e;
}
restore_error_handler();
@ -150,72 +159,84 @@ PHP
public function testConstruct()
{
$handler = ErrorHandler::register(3);
try {
$handler = ErrorHandler::register(3);
$level = new \ReflectionProperty($handler, 'level');
$level->setAccessible(true);
$level = new \ReflectionProperty($handler, 'level');
$level->setAccessible(true);
$this->assertEquals(3, $level->getValue($handler));
$this->assertEquals(3, $level->getValue($handler));
restore_error_handler();
restore_error_handler();
} catch (\Exception $e) {
restore_error_handler();
throw $e;
}
}
public function testHandle()
{
$handler = ErrorHandler::register(0);
$this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(3);
$this->assertFalse($handler->handle(4, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(3);
try {
$handler->handle(111, 'foo', 'foo.php', 12, 'foo');
} catch (\ErrorException $e) {
$this->assertSame('111: foo in foo.php line 12', $e->getMessage());
$this->assertSame(111, $e->getSeverity());
$this->assertSame('foo.php', $e->getFile());
$this->assertSame(12, $e->getLine());
$handler = ErrorHandler::register(0);
$this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(3);
$this->assertFalse($handler->handle(4, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(3);
try {
$handler->handle(111, 'foo', 'foo.php', 12, 'foo');
} catch (\ErrorException $e) {
$this->assertSame('111: foo in foo.php line 12', $e->getMessage());
$this->assertSame(111, $e->getSeverity());
$this->assertSame('foo.php', $e->getFile());
$this->assertSame(12, $e->getLine());
}
restore_error_handler();
$handler = ErrorHandler::register(E_USER_DEPRECATED);
$this->assertTrue($handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(E_DEPRECATED);
$this->assertTrue($handler->handle(E_DEPRECATED, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$logger = $this->getMock('Psr\Log\LoggerInterface');
$that = $this;
$warnArgCheck = function($message, $context) use ($that) {
$that->assertEquals('foo', $message);
$that->assertArrayHasKey('type', $context);
$that->assertEquals($context['type'], ErrorHandler::TYPE_DEPRECATION);
$that->assertArrayHasKey('stack', $context);
$that->assertInternalType('array', $context['stack']);
};
$logger
->expects($this->once())
->method('warning')
->will($this->returnCallback($warnArgCheck))
;
$handler = ErrorHandler::register(E_USER_DEPRECATED);
$handler->setLogger($logger);
$handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo');
restore_error_handler();
} catch (\Exception $e) {
restore_error_handler();
throw $e;
}
restore_error_handler();
$handler = ErrorHandler::register(E_USER_DEPRECATED);
$this->assertTrue($handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$handler = ErrorHandler::register(E_DEPRECATED);
$this->assertTrue($handler->handle(E_DEPRECATED, 'foo', 'foo.php', 12, 'foo'));
restore_error_handler();
$logger = $this->getMock('Psr\Log\LoggerInterface');
$that = $this;
$warnArgCheck = function($message, $context) use ($that) {
$that->assertEquals('foo', $message);
$that->assertArrayHasKey('type', $context);
$that->assertEquals($context['type'], ErrorHandler::TYPE_DEPRECATION);
$that->assertArrayHasKey('stack', $context);
$that->assertInternalType('array', $context['stack']);
};
$logger
->expects($this->once())
->method('warning')
->will($this->returnCallback($warnArgCheck))
;
$handler = ErrorHandler::register(E_USER_DEPRECATED);
$handler->setLogger($logger);
$handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo');
restore_error_handler();
}
/**
@ -246,10 +267,10 @@ PHP
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined function test_namespaced_function()',
'message' => 'Call to undefined function test_namespaced_function_again()',
),
'Symfony\Component\Debug\Exception\UndefinedFunctionException',
'Attempted to call function "test_namespaced_function" from the global namespace in foo.php line 12. Did you mean to call: "\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function"?',
'Attempted to call function "test_namespaced_function_again" from the global namespace in foo.php line 12. Did you mean to call: "\\symfony\\component\\debug\\tests\\test_namespaced_function_again"?',
),
// class not found
array(
@ -265,3 +286,8 @@ PHP
);
}
}
function test_namespaced_function_again()
{
}

View File

@ -12,8 +12,8 @@
</trans-unit>
<trans-unit id="30">
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>Das CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden.</target>
<target>Der CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden.</target>
</trans-unit>
</body>
</file>
</xliff>
</xliff>

View File

@ -12,7 +12,7 @@
</trans-unit>
<trans-unit id="30">
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>El token CSRF no es válido. Por favor, pruebe de enviar nuevamente el formulario</target>
<target>El token CSRF no es válido. Por favor, pruebe de enviar nuevamente el formulario.</target>
</trans-unit>
</body>
</file>

View File

@ -12,7 +12,7 @@
</trans-unit>
<trans-unit id="30">
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>O token CSRF non é válido. Por favor, probe a enviar novamente o formulario</target>
<target>O token CSRF non é válido. Por favor, probe a enviar novamente o formulario.</target>
</trans-unit>
</body>
</file>

View File

@ -4,15 +4,15 @@
<body>
<trans-unit id="28">
<source>This form should not contain extra fields.</source>
<target>フィールドグループに追加のフィールドを含んではなりません.</target>
<target>フィールドグループに追加のフィールドを含んではなりません</target>
</trans-unit>
<trans-unit id="29">
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
<target>アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください.</target>
<target>アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください</target>
</trans-unit>
<trans-unit id="30">
<source>The CSRF token is invalid.</source>
<target>CSRFトークンが無効です.</target>
<target>CSRFトークンが無効です</target>
</trans-unit>
</body>
</file>

View File

@ -712,7 +712,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass));
if (!$this->debug) {
$content = self::stripComments($content);
$content = static::stripComments($content);
}
$cache->write($content, $container->getResources());

View File

@ -20,7 +20,7 @@ use Symfony\Component\Stopwatch\StopwatchEvent;
*/
class StopwatchEventTest extends \PHPUnit_Framework_TestCase
{
const DELTA = 20;
const DELTA = 37;
public function testGetOrigin()
{

View File

@ -80,7 +80,7 @@
</trans-unit>
<trans-unit id="20">
<source>This value should be {{ limit }} or more.</source>
<target>هذه القيمة يجب ان تكون {{ limit }} او اكثر</target>
<target>هذه القيمة يجب ان تكون {{ limit }} او اكثر.</target>
</trans-unit>
<trans-unit id="21">
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
@ -104,7 +104,7 @@
</trans-unit>
<trans-unit id="26">
<source>This value is not a valid time.</source>
<target>هذه القيمة ليست وقت صحيح</target>
<target>هذه القيمة ليست وقت صحيح.</target>
</trans-unit>
<trans-unit id="27">
<source>This value is not a valid URL.</source>

View File

@ -124,7 +124,7 @@
</trans-unit>
<trans-unit id="34">
<source>The file could not be uploaded.</source>
<target>Methwyd <20> uwchlwytho'r ffeil. </target>
<target>Methwyd <20> uwchlwytho'r ffeil.</target>
</trans-unit>
<trans-unit id="35">
<source>This value should be a valid number.</source>

View File

@ -192,7 +192,7 @@
</trans-unit>
<trans-unit id="51">
<source>No temporary folder was configured in php.ini.</source>
<target>Direktori sementara tidak dikonfiguasi pada php.ini</target>
<target>Direktori sementara tidak dikonfiguasi pada php.ini.</target>
</trans-unit>
<trans-unit id="52">
<source>Cannot write temporary file to disk.</source>

View File

@ -4,7 +4,7 @@
<body>
<trans-unit id="1">
<source>This value should be false.</source>
<target>Verdien skulle ha vore tom/nei</target>
<target>Verdien skulle ha vore tom/nei.</target>
</trans-unit>
<trans-unit id="2">
<source>This value should be true.</source>

View File

@ -132,7 +132,7 @@
</trans-unit>
<trans-unit id="36">
<source>This file is not a valid image.</source>
<target>Este ficheito não é uma imagem.</target>
<target>Este ficheiro não é uma imagem.</target>
</trans-unit>
<trans-unit id="37">
<source>This is not a valid IP address.</source>

View File

@ -24,7 +24,7 @@
</trans-unit>
<trans-unit id="6">
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
<target>Você deve selecionar, no mínimo, {{ limit }} opção.|Você deve selecionar, no mínimo, {{ limit }} opções</target>
<target>Você deve selecionar, no mínimo, {{ limit }} opção.|Você deve selecionar, no mínimo, {{ limit }} opções.</target>
</trans-unit>
<trans-unit id="7">
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>

View File

@ -236,7 +236,7 @@
</trans-unit>
<trans-unit id="62">
<source>This value is neither a valid ISBN-10 nor a valid ISBN-13.</source>
<target>Значение не соответствует форматам ISBN-10 и ISBN-13</target>
<target>Значение не соответствует форматам ISBN-10 и ISBN-13.</target>
</trans-unit>
<trans-unit id="63">
<source>This value is not a valid ISSN.</source>

View File

@ -204,15 +204,15 @@
</trans-unit>
<trans-unit id="54">
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
<target>Bu derlem {{ limit }} veya daha çok eleman içermelidir</target>
<target>Bu derlem {{ limit }} veya daha çok eleman içermelidir.</target>
</trans-unit>
<trans-unit id="55">
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
<target>Bu derlem {{ limit }} veya daha az eleman içermelidir</target>
<target>Bu derlem {{ limit }} veya daha az eleman içermelidir.</target>
</trans-unit>
<trans-unit id="56">
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
<target>Bu derlem {{ limit }} eleman içermelidir</target>
<target>Bu derlem {{ limit }} eleman içermelidir.</target>
</trans-unit>
<trans-unit id="57">
<source>Invalid card number.</source>

View File

@ -28,7 +28,7 @@
</trans-unit>
<trans-unit id="7">
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
<target>Ви повинні обрати не більше ніж {{ limit }} варіантів</target>
<target>Ви повинні обрати не більше ніж {{ limit }} варіантів.</target>
</trans-unit>
<trans-unit id="8">
<source>One or more of the given values is invalid.</source>