8000 Merge branch '2.2' · symfony/symfony@83e078a · GitHub
[go: up one dir, main page]

Skip to content

Commit 83e078a

Browse files
committed
Merge branch '2.2'
* 2.2: Fix finding ACLs from ObjectIdentity's with different types [HttpKernel] tweaked previous merge #7531: [HttpKernel][Config] FileLocator adds NULL as global resource path Fix autocompletion of command names when namespaces conflict Fix timeout in Process::stop method fixed CS Round stream_select fifth argument up. Fix Process timeout [HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259 bumped Symfony version to 2.2.2-DEV updated VERSION for 2.2.1 updated CHANGELOG for 2.2.1 Fixed phpdoc blocks to show that $uri can be passed as a string or ControllerReference (rather than just as a string) [HttpFoundation] Fixed copy pasted comment from FlashBag in AttributeBag [FrameworkBundle] fixed the discovery of the PHPUnit configuration file when using aggregate options like in -vc app/ (closes #7562) [WebProfilerBundle] removed next pointer class in a template fix overwriting of request's locale if attribute _locale is missing Conflicts: src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php src/Symfony/Component/HttpKernel/Kernel.php
2 parents 3a3ff28 + 2965a52 commit 83e078a

File tree

17 files changed

+343
-51
lines changed

17 files changed

+343
-51
lines changed

CHANGELOG-2.2.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,62 @@ in 2.2 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.2.0...v2.2.1
99

10+
* 2.2.1 (2013-04-06)
11+
12+
* 751abe1: Doctrine cannot handle bare random non-utf8 strings
13+
* 673fd9b: idAsIndex should be true with a smallint or bigint id field.
14+
* 64a1d39: Fixed long multibyte parameter logging in DbalLogger:startQuery
15+
* 4cf06c1: Keep the file extension in the temporary copy and test that it exists (closes #7482)
16+
* 64ac34d: [Security] fixed wrong interface
17+
* 9875c4b: Added '@@' escaping strategy for YamlFileLoader and YamlDumper
18+
* bbcdfe2: [Yaml] fixed bugs with folded scalar parsing
19+
* 5afea04: [Form] made DefaultCsrfProvider using session_status() when available
20+
* c928ddc: [HttpFoudantion] fixed Request::getPreferredLanguage()
21+
* e6b7515: [DomCrawler] added support for query string with slash
22+
* 633c051: Fixed invalid file path for hiddeninput.exe on Windows.
23+
* 7ef90d2: fix xsd definition for strict-requirements
24+
* 39445c5: [WebProfilerBundle] Fixed the toolbar styles to apply them in IE8
25+
* 601da45: [ClassLoader] fixed heredocs handling
26+
* 17dc2ff: [HttpRequest] fixes Request::getLanguages() bug
27+
* 67fbbac: [DoctrineBridge] Fixed non-utf-8 recognition
28+
* e51432a: sub-requests are now created with the same class as their parent
29+
* cc3a40e: [FrameworkBundle] changed temp kernel name in cache:clear
30+
* d7a7434: [Routing] fix url generation for optional parameter having a null value
31+
* ef53456: [DoctrineBridge] Avoids blob values to be logged by doctrine
32+
* 6575df6: [Security] use current request attributes to generate redirect url?
33+
* 7216cb0: [Validator] fix showing wrong max file size for upload errors
34+
* c423f16: [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge
35+
* 7d87ecd: [FrameworkBundle] fixed cahe:clear command's warmup
36+
* 5ad4bd1: [TwigBridge] now enter/leave scope on Twig_Node_Module
37+
* fe4cc24: [TwigBridge] fixed fixed scope & trans_default_domain node visitor
38+
* fc47589: [BrowserKit] added ability to ignored malformed set-cookie header
39+
* 602cdee: replace INF to PHP_INT_MAX inside Finder component.
40+
* 5bc30bb: [Translation] added xliff loader/dumper with resname support
41+
* 663c796: Property accessor custom array object fix
42+
* 4f3771d: [2.2][HttpKernel] fixed wrong option name in FragmentHandler::fixOptions
43+
* a735cbd: fix xargs pipe to work with spaces in dir names
44+
* 15bf033: [FrameworkBundle] fix router debug command
45+
* d16d193: [FramworkBundle] removed unused property of trans update command
46+
* 523ef29: Fix warning for buildXml method
47+
* 7241be9: [Finder] fixed a potential issue on Solaris where INF value is wrong (refs #7269)
48+
* 1d3da29: [FrameworkBundle] avoids cache:clear to break if new/old folders already exist
49+
* b9cdb9a: [HttpKernel] Fixed possible profiler token collision (closes #7272, closes #7171)
50+
* d1f5d25: [FrameworkBundle] Fixes invalid serialized objects in cache
51+
* c82c754: RedisProfilerStorage wrong db-number/index-number selected
52+
* e86fefa: Unset loading[$id] in ContainerBuilder on exception
53+
* 709518b: Default validation message translation fix.
54+
* c0687cd: remove() should not use deprecated getParent() so it does not trigger deprecation internally
55+
* 708c0d3: adjust routing tests to not use prefix in addCollection
56+
* acff735: [Routing] trigger deprecation warning for deprecated features that will be removed in 2.3
57+
* 41ad9d8: [Routing] make xml loader more tolerant
58+
* 73bead7: [ClassLoader] made DebugClassLoader idempotent
59+
* a4ec677: [DomCrawler] Fix relative path handling in links
60+
* 6681df0: [Console] fixed StringInput binding
61+
* 5bf2f71: [Console] added deprecation annotation
62+
* 8d9cd42: Routing issue with installation in a sub-directory ref: https://github.com/symfony/symfony/issues/7129
63+
* c97ee8d: [Translator] mention that the message id may also be an object that can be cast to string in TranslatorInterface and fix the IdentityTranslator that did not respect this
64+
* 5a36b2d: [Translator] fix MessageCatalogueInterface::getFallbackCatalogue that can return null
65+
1066
* 2.2.0 (2013-03-01)
1167

1268
* 5b19c89: [Console] fixed unparsed StringInput tokens

src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public function getFunctions()
4545
/**
4646
* Renders a fragment.
4747
*
48-
* @param string $uri A URI
49-
* @param array $options An array of options
48+
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
49+
* @param array $options An array of options
5050
*
5151
* @return string The fragment content
5252
*
@@ -63,9 +63,9 @@ public function renderFragment($uri, $options = array())
6363
/**
6464
* Renders a fragment.
6565
*
66-
* @param string $strategy A strategy name
67-
* @param string $uri A URI
68-
* @param array $options An array of options
66+
* @param string $strategy A strategy name
67+
* @param string|ControllerReference $uri A URI as a string or a ControllerReference instance
68+
* @param array $options An array of options
6969
*
7070
* @return string The fragment content
7171
*

src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

Lines changed: 4 additions & 4 deletions
$dir = realpath($reversedArgs[$argIndex - 1]);
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,19 @@ protected static function getPhpUnitXmlDir()
8484
}
8585

8686
/**
87-
* Finds the value of configuration flag from cli
87+
* Finds the value of the CLI configuration option.
8888
*
8989
* PHPUnit will use the last configuration argument on the command line, so this only returns
90-
* the last configuration argument
90+
* the last configuration argument.
9191
*
92-
* @return string The value of the phpunit cli configuration option
92+
* @return string The value of the PHPUnit cli configuration option
9393
*/
9494
private static function getPhpUnitCliConfigArgument()
9595
{
9696
$dir = null;
9797
$reversedArgs = array_reverse($_SERVER['argv']);
9898
foreach ($reversedArgs as $argIndex => $testArg) {
99-
if ($testArg === '-c' || $testArg === '--configuration') {
99+
if (preg_match('/^-[^ \-]*c$/', $testArg) || $testArg === '--configuration') {
100100
101101
break;
102102
} elseif (strpos($testArg, '--configuration=') === 0) {

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{{ collector.controller.method }}
1010
</span>
1111
{% else %}
12-
<span class="sf-toolbar-info-class sf-toolbar-info-with-next-pointer">{{ collector.controller }}</span>
12+
<span class="sf-toolbar-info-class">{{ collector.controller }}</span>
1313
{% endif %}
1414
{% endset %}
1515
{% set request_status_code_color = (400 > collector.statuscode) ? ((200 == collector.statuscode) ? 'green' : 'yellow') : 'red'%}

src/Symfony/Component/Console/Application.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -503,20 +503,24 @@ public function getNamespaces()
503503
*/
504504
public function findNamespace($namespace)
505505
{
506-
$allNamespaces = array();
507-
foreach ($this->getNamespaces() as $n) {
508-
$allNamespaces[$n] = explode(':', $n);
509-
}
510-
511-
$found = array();
506+
$allNamespaces = $this->getNamespaces();
507+
$found = '';
512508
foreach (explode(':', $namespace) as $i => $part) {
513-
$abbrevs = static::getAbbreviations(array_unique(array_values(array_filter(array_map(function ($p) use ($i) { return isset($p[$i]) ? $p[$i] : ''; }, $allNamespaces)))));
509+
// select sub-namespaces matching the current namespace we found
510+
$namespaces = array();
511+
foreach ($allNamespaces as $n) {
512+
if ('' === $found || 0 === strpos($n, $found)) {
513+
$namespaces[$n] = explode(':', $n);
514+
}
515+
}
516+
517+
$abbrevs = static::getAbbreviations(array_unique(array_values(array_filter(array_map(function ($p) use ($i) { return isset($p[$i]) ? $p[$i] : ''; }, $namespaces)))));
514518

515519
if (!isset($abbrevs[$part])) {
516520
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
517521

518522
if (1 <= $i) {
519-
$part = implode(':', $found).':'.$part;
523+
$part = $found.':'.$part;
520524
}
521525

522526
if ($alternatives = $this->findAlternativeNamespace($part, $abbrevs)) {
@@ -532,14 +536,19 @@ public function findNamespace($namespace)
532536
throw new \InvalidArgumentException($message);
533537
}
534538

539+
// there are multiple matches, but $part is an exact match of one of them so we select it
540+
if (in_array($part, $abbrevs[$part])) {
541+
$abbrevs[$part] = array($part);
542+
}
543+
535544
if (count($abbrevs[$part]) > 1) {
536545
throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions($abbrevs[$part])));
537546
}
538547

539-
$found[] = $abbrevs[$part][0];
548+
$found .= $found ? ':' . $abbrevs[$part][0] : $abbrevs[$part][0];
540549
}
541550

542-
return implode(':', $found);
551+
return $found;
543552
}
544553

545554
/**
@@ -662,21 +671,12 @@ public static function getAbbreviations($names)
662671
{
663672
$abbrevs = array();
664673
foreach ($names as $name) {
665-
for ($len = strlen($name) - 1; $len > 0; --$len) {
674+
for ($len = strlen($name); $len > 0; --$len) {
666675
$abbrev = substr($name, 0, $len);
667-
if (!isset($abbrevs[$abbrev])) {
668-
$abbrevs[$abbrev] = array($name);
669-
} else {
670-
$abbrevs[$abbrev][] = $name;
671-
}
676+
$abbrevs[$abbrev][] = $name;
672677
}
673678
}
674679

675-
// Non-abbreviations always get entered, even if they aren't unique
676-
foreach ($names as $name) {
677-
$abbrevs[$name] = array($name);
678-
}
679-
680680
return $abbrevs;
681681
}
682682

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ public function testFindAlternativeNamespace()
351351
}
352352
}
353353

354+
public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces()
355+
{
356+
$application = $this->getMock('Symfony\Component\Console\Application', array('getNamespaces'));
357+
$application->expects($this->once())
358+
->method('getNamespaces')
359+
->will($this->returnValue(array('foo:sublong', 'bar:sub')));
360+
361+
$this->assertEquals('foo:sublong', $application->findNamespace('f:sub'));
362+
}
363+
354364
public function testSetCatchExceptions()
355365
{
356366
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ public function handle($level, $message, $file, $line, $context)
8787

8888
if ($level & (E_USER_DEPRECATED | E_DEPRECATED)) {
8989
if (null !== self::$logger 10000 ) {
90-
$stack = version_compare(PHP_VERSION, '5.4', '<') ? array_slice(debug_backtrace(false), 0, 10) : debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
90+
if (version_compare(PHP_VERSION, '5.4', '<')) {
91+
$stack = array_map(
92+
function ($row) {
93+
unset($row['args']);
94+
return $row;
95+
},
96+
array_slice(debug_backtrace(false), 0, 10)
97+
);
98+
} else {
99+
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
100+
}
91101

92102
self::$logger->warning($message, array('type' => self::TYPE_DEPRECATION, 'stack' => $stack));
93103
}

src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
3131
/**
3232
* Constructor.
3333
*
34-
* @param string $storageKey The key used to store flashes in the session.
34+
* @param string $storageKey The key used to store attributes in the session.
3535
*/
3636
public function __construct($storageKey = '_sf2_attributes')
3737
{

src/Symfony/Component/HttpKernel/Config/FileLocator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ class FileLocator extends BaseFileLocator
2828
* Constructor.
2929
*
3030
* @param KernelInterface $kernel A KernelInterface instance
31-
* @param string $path The path the global resource directory
32-
* @param string|array $paths A path or an array of paths where to look for resources
31+
* @param null|string $path The path the global resource directory
32+
* @param array $paths An array of paths where to look for resources
3333
*/
3434
public function __construct(KernelInterface $kernel, $path = null, array $paths = array())
3535 10000
{
3636
$this->kernel = $kernel;
37-
$this->path = $path;
38-
$paths[] = $path;
37+
if (null !== $path) {
38+
$this->path = $path;
39+
$paths[] = $path;
40+
}
3941

4042
parent::__construct($paths);
4143
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\HttpKernel\Tests\Config;
13+
14+
use Symfony\Component\HttpKernel\Config\FileLocator;
15+
16+
class FileLocatorTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testLocate()
19+
{
20+
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
21+
$kernel
22+
->expects($this->atLeastOnce())
23+
->method('locateResource')
24+
->with('@BundleName/some/path', null, true)
25+
->will($this->returnValue('/bundle-name/some/path'));
26+
$locator = new FileLocator($kernel);
27+
$this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path'));
28+
29+
$kernel
30+
->expects($this->never())
31+
->method('locateResource');
32+
$this->setExpectedException('LogicException');
33+
$locator->locate('/some/path');
34+
}
35+
36+
public function testLocateWithGlobalResourcePath()
37+
{
38+
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
39+
$kernel
40+
->expects($this->atLeastOnce())
41+
->method('locateResource')
42+
->with('@BundleName/some/path', '/global/resource/path', false);
43+
44+
$locator = new FileLocator($kernel, '/global/resource/path');
45+
$locator->locate('@BundleName/some/path', null, false);
46+
}
47+
}

src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ public function testLocaleSetForRoutingContext()
6868
$listener->onKernelRequest($this->getEvent($request));
6969
}
7070

71+
public function testRequestLocaleIsNotOverridden()
72+
{
73+
$request = Request::create('/');
74+
$request->setLocale('de');
75+
$listener = new LocaleListener('fr');
76+
$event = $this->getEvent($request);
77+
78+
$listener->onKernelRequest($event);
79+
$this->assertEquals('de', $request->getLocale());
80+
}
81+
7182
private function getEvent(Request $request)
7283
{
7384
return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST);

0 commit comments

Comments
 (0)
0