Skip to content

Commit bdcc357

Browse files
Merge branch '3.4'
* 3.4: [DI] Fix dumping with custom base class fixed typo [HttpFoundation] Add test [HttpFoundation] Fix session-related BC break [Process] Workaround PHP bug #75515 in ProcessTest::testSimpleInputStream() [FrameworkBundle] Wire the translation.reader service instead of deprecated translation.loader in commands fix method name
2 parents 0259fc5 + ecad1c4 commit bdcc357

File tree

7 files changed

+29
-21
lines changed

7 files changed

+29
-21
lines changed

UPGRADE-3.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Form
116116
```php
117117
class MyTimezoneType extends AbstractType
118118
{
119-
public function. getParent()
119+
public function getParent()
120120
{
121121
return TimezoneType::class;
122122
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ public function dump(array $options = array())
127127
$this->asFiles = $options['as_files'];
128128
$this->hotPathTag = $options['hot_path_tag'];
129129
$this->inlineRequires = $this->container->hasParameter($options['inline_class_loader_parameter']) && $this->container->getParameter($options['inline_class_loader_parameter']);
130-
$this->initializeMethodNamesMap($options['base_class']);
130+
131+
if (0 !== strpos($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) {
132+
$baseClass = sprintf('%s\%s', $options['namespace'] ? '\\'.$options['namespace'] : '', $baseClass);
133+
}
134+
135+
$this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass);
131136

132137
$this->docStar = $options['debug'] ? '*' : '';
133138

@@ -157,7 +162,7 @@ public function dump(array $options = array())
157162
}
158163

159164
$code =
160-
$this->startClass($options['class'], $options['base_class']).
165+
$this->startClass($options['class'], $baseClass).
161166
$this->addServices().
162167
$this->addDefaultParametersMethod().
163168
$this->endClass()

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @final since Symfony 3.3
1818
*/
19-
class Container extends AbstractContainer
19+
class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer
2020
{
2121
private $parameters;
2222
private $targetDirs = array();

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* either as "Y-m-d" string or as timestamp. Internally we still want to
5050
* use a DateTime object for processing. To convert the data from string/integer
5151
* to DateTime you can set a normalization transformer by calling
52-
* addNormTransformer(). The normalized data is then converted to the displayed
52+
* addModelTransformer(). The normalized data is then converted to the displayed
5353
* data as described before.
5454
*
5555
* The conversions (1) -> (2) -> (3) use the transform methods of the transformers.

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ class NativeSessionStorage implements SessionStorageInterface
9696
*/
9797
public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
9898
{
99-
$this->setMetadataBag($metaBag);
100-
101-
if (\PHP_SESSION_ACTIVE === session_status()) {
102-
return;
103-
}
104-
10599
$options += array(
106100
'cache_limiter' => '',
107101
'cache_expire' => 0,
@@ -112,6 +106,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB
112106

113107
session_register_shutdown();
114108

109+
$this->setMetadataBag($metaBag);
115110
$this->setOptions($options);
116111
$this->setSaveHandler($handler);
117112
}
@@ -346,7 +341,7 @@ public function isStarted()
346341
*/
347342
public function setOptions(array $options)
348343
{
349-
if (headers_sent()) {
344+
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
350345
return;
351346
}
352347

@@ -399,10 +394,6 @@ public function setSaveHandler($saveHandler = null)
399394
throw new \InvalidArgumentException('Must be instance of AbstractProxy; implement \SessionHandlerInterface; or be null.');
400395
}
401396

402-
if (headers_sent($file, $line)) {
403-
throw new \RuntimeException(sprintf('Failed to set the session handler because headers have already been sent by "%s" at line %d.', $file, $line));
404-
}
405-
406397
// Wrap $saveHandler in proxy and prevent double wrapping of proxy
407398
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
408399
$saveHandler = new SessionHandlerProxy($saveHandler);
@@ -411,6 +402,10 @@ public function setSaveHandler($saveHandler = null)
411402
}
412403
$this->saveHandler = $saveHandler;
413404

405+
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
406+
return;
407+
}
408+
414409
if ($this->saveHandler instanceof SessionHandlerProxy) {
415410
session_set_save_handler($this->saveHandler->getHandler(), false);
416411
} elseif ($this->saveHandler instanceof \SessionHandlerInterface) {

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,16 @@ public function testSetSessionOptionsOnceSessionStartedIsIgnored()
262262
// Assert no exception has been thrown by `getStorage()`
263263
$this->addToAssertionCount(1);
264264
}
265+
266+
public function testGetBagsOnceSessionStartedIsIgnored()
267+
{
268+
session_start();
269+
$bag = new AttributeBag();
270+
$bag->setName('flashes');
271+
272+
$storage = $this->getStorage();
273+
$storage->registerBag($bag);
274+
275+
$this->assertEquals($storage->getBag('flashes'), $bag);
276+
}
265277
}

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,13 +1210,9 @@ public function testIteratorInput()
12101210

12111211
public function testSimpleInputStream()
12121212
{
1213-
if (\PHP_VERSION_ID === 70200 && \PHP_EXTRA_VERSION === 'RC6') {
1214-
$this->markTestSkipped('See bug #75515 in PHP 7.2RC6.');
1215-
}
1216-
12171213
$input = new InputStream();
12181214

1219-
$process = $this->getProcessForCode('echo \'ping\'; stream_copy_to_stream(STDIN, STDOUT);');
1215+
$process = $this->getProcessForCode('echo \'ping\'; echo fread(STDIN, 4); echo fread(STDIN, 4);');
12201216
$process->setInput($input);
12211217

12221218
$process->start(function ($type, $data) use ($input) {

0 commit comments

Comments
 (0)