Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf4b09f

Browse files
Merge branch '4.0'
* 4.0: [HttpFoundation] Add Session::isEmpty(), fix MockFileSessionStorage to behave like the native one [HttpKernel] Add a better error messages when passing a private or non-tagged controller Test the suggestion of already registered services [VarDumper] Dont use empty(), it chokes on eg GMP objects [Dotenv] Changed preg_match flags from null to 0 remove upgrade instructions for kernel.root_dir [HttpKernel] Arrays with scalar values passed to ESI fragment renderer throw deprecation notice [DependencyInjection] Add more information to the message when passing miss matching class. [HttpKernel] add a test for FilterControllerEvents
2 parents7bab5b2 +32dfdb3 commitbf4b09f

File tree

20 files changed

+285
-25
lines changed

20 files changed

+285
-25
lines changed

‎UPGRADE-4.0.md‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,6 @@ HttpKernel
598598
tags:['console.command']
599599
```
600600
601-
* Removed the`kernel.root_dir` parameter. Use the `kernel.project_dir` parameter
602-
instead.
603-
604-
* Removed the `Kernel::getRootDir()` method. Use the `Kernel::getProjectDir()`
605-
method instead.
606-
607601
* The`Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been removed.
608602

609603
* Possibility to pass non-scalar values as URI attributes to the ESI and SSI

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
2929
protected$options =array(
3030
'check_path' =>'/login_check',
3131
'use_forward' =>false,
32-
'require_previous_session' =>true,
32+
'require_previous_session' =>false,
3333
);
3434

3535
protected$defaultSuccessHandlerOptions =array(

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function __construct()
2828
$this->addOption('password_path','password');
2929
$this->defaultFailureHandlerOptions =array();
3030
$this->defaultSuccessHandlerOptions =array();
31-
$this->options['require_previous_session'] =false;
3231
}
3332

3433
/**

‎src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ private function createTypeAlternatives(TypedReference $reference)
337337
return''.$message;
338338
}
339339

340-
if (isset($this->ambiguousServiceTypes[$type])) {
340+
$servicesAndAliases =$this->container->getServiceIds();
341+
if (!$this->container->has($type) &&false !==$key =array_search(strtolower($type),array_map('strtolower',$servicesAndAliases))) {
342+
returnsprintf(' Did you mean "%s"?',$servicesAndAliases[$key]);
343+
}elseif (isset($this->ambiguousServiceTypes[$type])) {
341344
$message =sprintf('one of these existing services: "%s"',implode('", "',$this->ambiguousServiceTypes[$type]));
342345
}elseif (isset($this->types[$type])) {
343346
$message =sprintf('the existing "%s" service',$this->types[$type]);

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,24 @@ public function provideNotWireableCalls()
685685
);
686686
}
687687

688+
/**
689+
* @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
690+
* @expectedExceptionMessage Cannot autowire service "foo": argument "$sam" of method "Symfony\Component\DependencyInjection\Tests\Compiler\NotWireable::setNotAutowireableBecauseOfATypo()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\lesTilleuls" but no such service exists. Did you mean "Symfony\Component\DependencyInjection\Tests\Compiler\LesTilleuls"?
691+
*/
692+
publicfunctiontestSuggestRegisteredServicesWithSimilarCase()
693+
{
694+
$container =newContainerBuilder();
695+
696+
$container->register(LesTilleuls::class, LesTilleuls::class);
697+
$container->register('foo', NotWireable::class)->setAutowired(true)
698+
->addMethodCall('setNotAutowireableBecauseOfATypo',array())
699+
;
700+
701+
(newResolveClassPass())->process($container);
702+
(newAutowireRequiredMethodsPass())->process($container);
703+
(newAutowirePass())->process($container);
704+
}
705+
688706
/**
689707
* @expectedException \Symfony\Component\DependencyInjection\Exception\AutowiringFailedException
690708
* @expectedExceptionMessage Cannot autowire service "j": argument "$i" of method "Symfony\Component\DependencyInjection\Tests\Compiler\J::__construct()" references class "Symfony\Component\DependencyInjection\Tests\Compiler\I" but no such service exists. Try changing the type-hint to "Symfony\Component\DependencyInjection\Tests\Compiler\IInterface" instead.

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ public function setNotAutowireable(NotARealClass $n)
299299
{
300300
}
301301

302+
publicfunctionsetNotAutowireableBecauseOfATypo(lesTilleuls$sam)
303+
{
304+
}
305+
302306
publicfunctionsetBar()
303307
{
304308
}

‎src/Symfony/Component/Dotenv/Dotenv.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private function lexVarname()
174174

175175
privatefunctionlexValue()
176176
{
177-
if (preg_match('/[ \t]*+(?:#.*)?$/Am',$this->data,$matches,null,$this->cursor)) {
177+
if (preg_match('/[ \t]*+(?:#.*)?$/Am',$this->data,$matches,0,$this->cursor)) {
178178
$this->moveCursor($matches[0]);
179179
$this->skipEmptyLines();
180180

@@ -296,7 +296,7 @@ private function lexNestedExpression()
296296

297297
privatefunctionskipEmptyLines()
298298
{
299-
if (preg_match('/(?:\s*+(?:#[^\n]*+)?+)++/A',$this->data,$match,null,$this->cursor)) {
299+
if (preg_match('/(?:\s*+(?:#[^\n]*+)?+)++/A',$this->data,$match,0,$this->cursor)) {
300300
$this->moveCursor($match[0]);
301301
}
302302
}

‎src/Symfony/Component/HttpFoundation/Session/Session.php‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
2828

2929
private$flashName;
3030
private$attributeName;
31+
private$data =array();
3132

3233
/**
3334
* @param SessionStorageInterface $storage A SessionStorageInterface instance
@@ -108,7 +109,7 @@ public function remove($name)
108109
*/
109110
publicfunctionclear()
110111
{
111-
$this->storage->getBag($this->attributeName)->clear();
112+
$this->getAttributeBag()->clear();
112113
}
113114

114115
/**
@@ -139,6 +140,22 @@ public function count()
139140
returncount($this->getAttributeBag()->all());
140141
}
141142

143+
/**
144+
* @return bool
145+
*
146+
* @internal
147+
*/
148+
publicfunctionisEmpty()
149+
{
150+
foreach ($this->dataas &$data) {
151+
if (!empty($data)) {
152+
returnfalse;
153+
}
154+
}
155+
156+
returntrue;
157+
}
158+
142159
/**
143160
* {@inheritdoc}
144161
*/
@@ -210,15 +227,15 @@ public function getMetadataBag()
210227
*/
211228
publicfunctionregisterBag(SessionBagInterface$bag)
212229
{
213-
$this->storage->registerBag($bag);
230+
$this->storage->registerBag(newSessionBagProxy($bag,$this->data));
214231
}
215232

216233
/**
217234
* {@inheritdoc}
218235
*/
219236
publicfunctiongetBag($name)
220237
{
221-
return$this->storage->getBag($name);
238+
return$this->storage->getBag($name)->getBag();
222239
}
223240

224241
/**
@@ -240,6 +257,6 @@ public function getFlashBag()
240257
*/
241258
privatefunctiongetAttributeBag()
242259
{
243-
return$this->storage->getBag($this->attributeName);
260+
return$this->storage->getBag($this->attributeName)->getBag();
244261
}
245262
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
namespaceSymfony\Component\HttpFoundation\Session;
13+
14+
/**
15+
* @author Nicolas Grekas <p@tchwork.com>
16+
*
17+
* @internal
18+
*/
19+
finalclass SessionBagProxyimplements SessionBagInterface
20+
{
21+
private$bag;
22+
private$data;
23+
24+
publicfunction__construct(SessionBagInterface$bag,array &$data)
25+
{
26+
$this->bag =$bag;
27+
$this->data = &$data;
28+
}
29+
30+
/**
31+
* @return SessionBagInterface
32+
*/
33+
publicfunctiongetBag()
34+
{
35+
return$this->bag;
36+
}
37+
38+
/**
39+
* @return bool
40+
*/
41+
publicfunctionisEmpty()
42+
{
43+
returnempty($this->data[$this->bag->getStorageKey()]);
44+
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
publicfunctiongetName()
50+
{
51+
return$this->bag->getName();
52+
}
53+
54+
/**
55+
* {@inheritdoc}
56+
*/
57+
publicfunctioninitialize(array &$array)
58+
{
59+
$this->data[$this->bag->getStorageKey()] = &$array;
60+
61+
$this->bag->initialize($array);
62+
}
63+
64+
/**
65+
* {@inheritdoc}
66+
*/
67+
publicfunctiongetStorageKey()
68+
{
69+
return$this->bag->getStorageKey();
70+
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*/
75+
publicfunctionclear()
76+
{
77+
return$this->bag->clear();
78+
}
79+
}

‎src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,26 @@ public function save()
9191
thrownew \RuntimeException('Trying to save a session that was not started yet or was already closed');
9292
}
9393

94-
file_put_contents($this->getFilePath(),serialize($this->data));
94+
$data =$this->data;
95+
96+
foreach ($this->bagsas$bag) {
97+
if (empty($data[$key =$bag->getStorageKey()])) {
98+
unset($data[$key]);
99+
}
100+
}
101+
if (array($key =$this->metadataBag->getStorageKey()) ===array_keys($data)) {
102+
unset($data[$key]);
103+
}
104+
105+
try {
106+
if ($data) {
107+
file_put_contents($this->getFilePath(),serialize($data));
108+
}else {
109+
$this->destroy();
110+
}
111+
}finally {
112+
$this->data =$data;
113+
}
95114

96115
// this is needed for Silex, where the session object is re-used across requests
97116
// in functional tests. In Symfony, the container is rebooted, so we don't have

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp