Permalink
Browse files

Merge branch '2.1'

* 2.1:
  fixed CS
  fixed CS
  [Security] fixed path info encoding (closes #6040, closes #5695)
  [HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037)
  Improved Cache-Control header when no-cache is sent
  removed unneeded comment
  Fix to allow null values in labels array
  fix date in changelog
  removed the Travis icon (as this is not stable enough -- many false positive, closes #6186)
  Revert "merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)" (closes #6224)
  Fixed a typo
  Fixed: HeaderBag::parseCacheControl() not parsing quoted zero correctly
  [Form] Fix const inside an anonymous function
  [Config] Loader::import must return imported data
  [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed
  [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text"
  [HttpFoundation] fixed a small regression

Conflicts:
	src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
  • Loading branch information...
fabpot committed Dec 11, 2012
2 parents 1c1de14 + 872bf50 commit 278e3eec86b0da5cec349c6250f1686e6f3d62fc
Showing with 183 additions and 86 deletions.
  1. +1 −1 CHANGELOG-2.1.md
  2. +0 −2 README.md
  3. +4 −4 src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
  4. +1 −1 src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php
  5. +43 −2 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
  6. +0 −1 src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
  7. +1 −1 src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
  8. +2 −2 src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php
  9. +3 −1 src/Symfony/Component/Config/Loader/Loader.php
  10. +9 −0 src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
  11. +0 −1 src/Symfony/Component/Console/Tests/ApplicationTest.php
  12. +0 −1 src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
  13. +0 −2 src/Symfony/Component/CssSelector/Node/FunctionNode.php
  14. +3 −3 src/Symfony/Component/Filesystem/Filesystem.php
  15. +8 −4 src/Symfony/Component/Finder/SplFileInfo.php
  16. +1 −1 src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php
  17. +0 −1 src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php
  18. +5 −1 src/Symfony/Component/Form/Extension/Core/Type/DateType.php
  19. +1 −1 src/Symfony/Component/Form/Extension/Core/Type/FileType.php
  20. +1 −1 src/Symfony/Component/Form/Guess/Guess.php
  21. +32 −32 src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
  22. +13 −0 src/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php
  23. +0 −1 src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php
  24. +3 −3 src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
  25. +0 −2 src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
  26. +1 −1 src/Symfony/Component/HttpFoundation/HeaderBag.php
  27. +1 −1 src/Symfony/Component/HttpFoundation/Request.php
  28. +0 −1 src/Symfony/Component/HttpFoundation/RequestMatcher.php
  29. +6 −0 src/Symfony/Component/HttpFoundation/Response.php
  30. +7 −0 src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php
  31. +17 −0 src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
  32. +1 −0 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
  33. +1 −2 src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php
  34. +7 −4 src/Symfony/Component/Locale/Resources/data/build-data.php
  35. +1 −2 src/Symfony/Component/Process/Tests/AbstractProcessTest.php
  36. +0 −1 src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php
  37. +1 −0 src/Symfony/Component/Security/Http/Firewall/ContextListener.php
  38. +1 −1 src/Symfony/Component/Security/Http/HttpUtils.php
  39. +5 −0 src/Symfony/Component/Security/Tests/Http/HttpUtilsTest.php
  40. +2 −2 src/Symfony/Component/Validator/Constraints/Regex.php
  41. +1 −2 src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
View
@@ -7,7 +7,7 @@ in 2.1 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.1.0...v2.1.1
-* 2.1.4 (2012-12-29)
+* 2.1.4 (2012-11-29)
* e5536f0: replaced magic strings by proper constants
* 6a3ba52: fixed the logic in Request::isSecure() (if the information comes from a source that we trust, don't check other ones)
View
@@ -1,8 +1,6 @@
README
======
-[![Build Status](https://secure.travis-ci.org/symfony/symfony.png?branch=master)](http://travis-ci.org/symfony/symfony)
-
What is Symfony2?
-----------------
@@ -77,16 +77,16 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
// A second parameter ($key) is passed, so we cannot use
// spl_object_hash() directly (which strictly requires
// one parameter)
- array_walk_recursive($choiceHashes, function ($value) {
- return spl_object_hash($value);
+ array_walk_recursive($choiceHashes, function (&$value) {
+ $value = spl_object_hash($value);
});
}
$preferredChoiceHashes = $options['preferred_choices'];
if (is_array($preferredChoiceHashes)) {
- array_walk_recursive($preferredChoiceHashes, function ($value) {
- return spl_object_hash($value);
+ array_walk_recursive($preferredChoiceHashes, function (&$value) {
+ $value = spl_object_hash($value);
});
}
@@ -86,4 +86,4 @@ private function getGuesser(ClassMetadata $classMetadata)
return new DoctrineOrmTypeGuesser($registry);
}
-}
+}
@@ -104,7 +104,7 @@ public function testCollapsedEntityField()
{
$this->setMaxRunningTime(1);
- for ($i = 0; $i < 20; ++$i) {
+ for ($i = 0; $i < 40; ++$i) {
$form = $this->factory->create('entity', null, array(
'class' => self::ENTITY_CLASS,
));
@@ -114,11 +114,14 @@ public function testCollapsedEntityField()
}
}
+ /**
+ * @group benchmark
+ */
public function testCollapsedEntityFieldWithQueryBuilder()
{
$this->setMaxRunningTime(1);
- for ($i = 0; $i < 20; ++$i) {
+ for ($i = 0; $i < 40; ++$i) {
$form = $this->factory->create('entity', null, array(
'class' => self::ENTITY_CLASS,
'query_builder' => function (EntityRepository $repo) {
@@ -130,4 +133,42 @@ public function testCollapsedEntityFieldWithQueryBuilder()
$form->createView();
}
}
+
+ /**
+ * @group benchmark
+ */
+ public function testCollapsedEntityFieldWithChoices()
+ {
+ $choices = $this->em->createQuery('SELECT c FROM ' . self::ENTITY_CLASS . ' c')->getResult();
+ $this->setMaxRunningTime(1);
+
+ for ($i = 0; $i < 40; ++$i) {
+ $form = $this->factory->create('entity', null, array(
+ 'class' => self::ENTITY_CLASS,
+ 'choices' => $choices,
+ ));
+
+ // force loading of the choice list
+ $form->createView();
+ }
+ }
+
+ /**
+ * @group benchmark
+ */
+ public function testCollapsedEntityFieldWithPreferredChoices()
+ {
+ $choices = $this->em->createQuery('SELECT c FROM ' . self::ENTITY_CLASS . ' c')->getResult();
+ $this->setMaxRunningTime(1);
+
+ for ($i = 0; $i < 40; ++$i) {
+ $form = $this->factory->create('entity', null, array(
+ 'class' => self::ENTITY_CLASS,
+ 'preferred_choices' => $choices,
+ ));
+
+ // force loading of the choice list
+ $form->createView();
+ }
+ }
}
@@ -11,7 +11,6 @@
namespace Symfony\Bridge\Doctrine\Tests\Logger;
-
class DbalLoggerTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -78,7 +78,7 @@ public function redirect($url, $status = 302)
* @param string $view The view name
* @param array $parameters An array of parameters to pass to the view
*
- * @return string The renderer view
+ * @return string The rendered view
*/
public function renderView($view, array $parameters = array())
{
@@ -23,7 +23,7 @@ public function values(array $values)
}
$this->values = $values;
-
+
return $this;
}
@@ -40,4 +40,4 @@ protected function instantiateNode()
return new EnumNode($this->name, $this->parent, $this->values);
}
-}
+}
@@ -47,10 +47,12 @@ public function setResolver(LoaderResolverInterface $resolver)
*
* @param mixed $resource A Resource
* @param string $type The resource type
+ *
+ * @return mixed
*/
public function import($resource, $type = null)
{
- $this->resolve($resource)->load($resource, $type);
+ return $this->resolve($resource)->load($resource, $type);
}
/**
@@ -55,6 +55,15 @@ public function testResolve()
$this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderLoadException', $e, '->resolve() throws a FileLoaderLoadException if the resource cannot be loaded');
}
}
+
+ public function testImport()
+ {
+ $loader = $this->getMock('Symfony\Component\Config\Loader\Loader', array('supports', 'load'));
+ $loader->expects($this->once())->method('supports')->will($this->returnValue(true));
+ $loader->expects($this->once())->method('load')->will($this->returnValue('yes'));
+
+ $this->assertEquals('yes', $loader->import('foo'));
+ }
}
class ProjectLoader1 extends Loader
@@ -242,7 +242,6 @@ public function testFindAlternativeExceptionMessage()
$this->assertRegExp('/Did you mean this/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with one alternative');
}
-
$application->add(new \Foo1Command());
$application->add(new \Foo2Command());
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
namespace Symfony\Component\Console\Tests\Formatter;
use Symfony\Component\Console\Formatter\OutputFormatter;
@@ -209,7 +209,6 @@ protected function _xpath_contains($xpath, $expr)
$xpath->addCondition(sprintf('contains(string(.), %s)', XPathExpr::xpathLiteral($expr)));
// FIXME: Currently case insensitive matching doesn't seem to be happening
-
return $xpath;
}
@@ -264,7 +263,6 @@ protected function parseSeries($s)
if (false === strpos($s, 'n')) {
// Just a b
-
return array(0, intval((string) $s));
}
@@ -360,17 +360,17 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
if ($copyOnWindows) {
if (is_link($file) || is_file($file)) {
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
- } else if (is_dir($file)) {
+ } elseif (is_dir($file)) {
$this->mkdir($target);
} else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
}
} else {
if (is_link($file)) {
$this->symlink($file, $target);
- } else if (is_dir($file)) {
+ } elseif (is_dir($file)) {
$this->mkdir($target);
- } else if (is_file($file)) {
+ } elseif (is_file($file)) {
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
} else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file));
@@ -62,10 +62,14 @@ public function getRelativePathname()
*/
public function getContents()
{
- $file = new \SplFileObject($this->getRealpath(), 'rb');
- ob_start();
- $file->fpassthru();
+ $level = error_reporting(0);
+ $content = file_get_contents($this->getRealpath());
+ error_reporting($level);
+ if (false === $content) {
+ $error = error_get_last();
+ throw new \RuntimeException($error['message']);
+ }
- return ob_get_clean();
+ return $content;
}
}
@@ -261,7 +261,7 @@ protected function addChoices(array &$bucketForPreferred, array &$bucketForRemai
{
// Add choices to the nested buckets
foreach ($choices as $group => $choice) {
- if (!isset($labels[$group])) {
+ if (!array_key_exists($group, $labels)) {
throw new \InvalidArgumentException('The structures of the choices and labels array do not match.');
}
@@ -53,7 +53,6 @@ public function reverseTransform($rfc3339)
return null;
}
-
$dateTime = new \DateTime($rfc3339);
if ($this->outputTimezone !== $this->inputTimezone) {
@@ -180,6 +180,10 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
);
};
+ $format = function (Options $options) {
+ return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
+ };
+
// BC until Symfony 2.3
$modelTimezone = function (Options $options) {
return $options['data_timezone'];
@@ -196,7 +200,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'days' => range(1, 31),
'widget' => 'choice',
'input' => 'datetime',
- 'format' => self::HTML5_FORMAT,
+ 'format' => $format,
'model_timezone' => $modelTimezone,
'view_timezone' => $viewTimezone,
// Deprecated timezone options
@@ -46,7 +46,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'compound' => false,
- 'data_class' => 'Symfony\Component\HttpFoundation\File\File'
+ 'data_class' => 'Symfony\Component\HttpFoundation\File\File'
));
}
@@ -90,7 +90,7 @@ public static function getBestGuess(array $guesses)
*/
public function __construct($confidence)
{
- if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
+ if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
}
Oops, something went wrong.

0 comments on commit 278e3ee

Please sign in to comment.