Skip to content

Commit 1e88b35

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: [FrameworkBundle] Set default public directory on install assets [Security] Fix wrong term in UserProviderInterface [HttpFoundation] Set meta refresh time to 0 in RedirectResponse content disable inlining deprecated services [Cache] add constructor docblocks for clarity [WebServerBundle] allowed public/ root directory to be auto-discovered along side web/ [WebServerBundle] remove duplicate code [SecurityBundle] Clarify deprecation in UserPasswordEncoderCommand::getContainer [Cache] add constructor docblocks for clarity [Security] validate empty passwords again [DI] Remove irrelevant comment from container [TwigBridge] cleaner implementation of the TwigRenderer
2 parents 2fa948d + 649e2cd commit 1e88b35

30 files changed

+198
-47
lines changed

UPGRADE-4.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ SecurityBundle
484484

485485
* The `UserPasswordEncoderCommand` class does not allow `null` as the first argument anymore.
486486

487-
* `UserPasswordEncoderCommand` does not implement `ContainerAwareInterface` anymore.
487+
* `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` nor implement `ContainerAwareInterface` anymore.
488488

489489
Serializer
490490
----------

src/Symfony/Bridge/Twig/Form/TwigRenderer.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,26 @@
2424
*/
2525
class TwigRenderer extends FormRenderer implements TwigRendererInterface
2626
{
27-
/**
28-
* @var TwigRendererEngineInterface
29-
*/
30-
private $engine;
31-
3227
public function __construct(TwigRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null)
3328
{
3429
parent::__construct($engine, $csrfTokenManager);
30+
}
3531

36-
$this->engine = $engine;
32+
/**
33+
* Returns the engine used by this renderer.
34+
*
35+
* @return TwigRendererEngineInterface The renderer engine
36+
*/
37+
public function getEngine()
38+
{
39+
return parent::getEngine();
3740
}
3841

3942
/**
4043
* {@inheritdoc}
4144
*/
4245
public function setEnvironment(Environment $environment)
4346
{
44-
$this->engine->setEnvironment($environment);
47+
$this->getEngine()->setEnvironment($environment);
4548
}
4649
}

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,28 @@ protected function configure()
4646
$this
4747
->setName('assets:install')
4848
->setDefinition(array(
49-
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', 'web'),
49+
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', 'public'),
5050
))
5151
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
5252
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
53-
->setDescription('Installs bundles web assets under a public web directory')
53+
->setDescription('Installs bundles web assets under a public directory')
5454
->setHelp(<<<'EOT'
5555
The <info>%command.name%</info> command installs bundle assets into a given
56-
directory (e.g. the <comment>web</comment> directory).
56+
directory (e.g. the <comment>public</comment> directory).
5757
58-
<info>php %command.full_name% web</info>
58+
<info>php %command.full_name% public</info>
5959
6060
A "bundles" directory will be created inside the target directory and the
6161
"Resources/public" directory of each bundle will be copied into it.
6262
6363
To create a symlink to each bundle instead of copying its assets, use the
6464
<info>--symlink</info> option (will fall back to hard copies when symbolic links aren't possible:
6565
66-
<info>php %command.full_name% web --symlink</info>
66+
<info>php %command.full_name% public --symlink</info>
6767
6868
To make symlink relative, add the <info>--relative</info> option:
6969
70-
<info>php %command.full_name% web --symlink --relative</info>
70+
<info>php %command.full_name% public --symlink --relative</info>
7171

7272
EOT
7373
)
@@ -85,7 +85,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
8585
$targetArg = $this->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
8686

8787
if (!is_dir($targetArg)) {
88-
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
88+
// deprecated, logic to be removed in 4.0
89+
// this allows the commands to work out of the box with web/ and public/
90+
if (is_dir(dirname($targetArg).'/web')) {
91+
$targetArg = dirname($targetArg).'/web';
92+
} else {
93+
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
94+
}
8995
}
9096
}
9197

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CHANGELOG
1515
* Deprecated instantiating `UserPasswordEncoderCommand` without its constructor
1616
arguments fully provided.
1717
* Deprecated `UserPasswordEncoderCommand::getContainer()` and relying on the
18-
`ContainerAwareInterface` interface for this command.
18+
`ContainerAwareCommand` sub class or `ContainerAwareInterface` implementation for this command.
1919
* Deprecated the `FirewallMap::$map` and `$container` properties.
2020
* [BC BREAK] Keys of the `users` node for `in_memory` user provider are no longer normalized.
2121
* deprecated `FirewallContext::getListeners()`

src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(EncoderFactoryInterface $encoderFactory = null, arra
5151
*/
5252
protected function getContainer()
5353
{
54-
@trigger_error(sprintf('Method "%s" is deprecated since version 3.3 and "%s" won\'t implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareInterface::class), E_USER_DEPRECATED);
54+
@trigger_error(sprintf('Method "%s" is deprecated since version 3.3 and "%s" won\'t extend "%s" nor implement "%s" anymore in 4.0.', __METHOD__, __CLASS__, ContainerAwareCommand::class, ContainerAwareInterface::class), E_USER_DEPRECATED);
5555

5656
return parent::getContainer();
5757
}

src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888
{
8989
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
9090

91+
// deprecated, logic to be removed in 4.0
92+
// this allows the commands to work out of the box with web/ and public/
93+
if ($this->documentRoot && !is_dir($this->documentRoot) && is_dir(dirname($this->documentRoot).'/web')) {
94+
$this->documentRoot = dirname($this->documentRoot).'/web';
95+
}
96+
9197
if (null === $documentRoot = $input->getOption('docroot')) {
9298
if (!$this->documentRoot) {
9399
$io->error('The document root directory must be either passed as first argument of the constructor or through the "--docroot" input option.');
@@ -97,12 +103,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
97103
$documentRoot = $this->documentRoot;
98104
}
99105

100-
if (!is_dir($documentRoot)) {
101-
$io->error(sprintf('The document root directory "%s" does not exist.', $documentRoot));
102-
103-
return 1;
104-
}
105-
106106
if (!$env = $this->environment) {
107107
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
108108
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
return 1;
101101
}
102102

103+
// deprecated, logic to be removed in 4.0
104+
// this allows the commands to work out of the box with web/ and public/
105+
if ($this->documentRoot && !is_dir($this->documentRoot) && is_dir(dirname($this->documentRoot).'/web')) {
106+
$this->documentRoot = dirname($this->documentRoot).'/web';
107+
}
108+
103109
if (null === $documentRoot = $input->getOption('docroot')) {
104110
if (!$this->documentRoot) {
105111
$io->error('The document root directory must be either passed as first argument of the constructor or through the "docroot" input option.');
@@ -109,12 +115,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
109115
$documentRoot = $this->documentRoot;
110116
}
111117

112-
if (!is_dir($documentRoot)) {
113-
$io->error(sprintf('The document root directory "%s" does not exist.', $documentRoot));
114-
115-
return 1;
116-
}
117-
118118
if (!$env = $this->environment) {
119119
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
120120
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');

src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<defaults public="false" />
99

1010
<service id="web_server.command.server_run" class="Symfony\Bundle\WebServerBundle\Command\ServerRunCommand">
11-
<argument>%kernel.project_dir%/web</argument>
11+
<argument>%kernel.project_dir%/public</argument>
1212
<argument>%kernel.environment%</argument>
1313
<tag name="console.command" command="server:run" />
1414
</service>
1515

1616
<service id="web_server.command.server_start" class="Symfony\Bundle\WebServerBundle\Command\ServerStartCommand">
17-
<argument>%kernel.project_dir%/web</argument>
17+
<argument>%kernel.project_dir%/public</argument>
1818
<argument>%kernel.environment%</argument>
1919
<tag name="console.command" command="server:start" />
2020
</service>

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
3232
private $createCacheItem;
3333
private $mergeByLifetime;
3434

35+
/**
36+
* @var int|null The maximum length to enforce for identifiers or null when no limit applies
37+
*/
38+
protected $maxIdLength;
39+
40+
/**
41+
* @param string $namespace
42+
* @param int $defaultLifetime
43+
*/
3544
protected function __construct($namespace = '', $defaultLifetime = 0)
3645
{
3746
$this->namespace = '' === $namespace ? '' : $this->getId($namespace).':';
@@ -74,6 +83,15 @@ function ($deferred, $namespace, &$expiredIds) {
7483
);
7584
}
7685

86+
/**
87+
* @param string $namespace
88+
* @param int $defaultLifetime
89+
* @param string $version
90+
* @param string $directory
91+
* @param LoggerInterface|null $logger
92+
*
93+
* @return AdapterInterface
94+
*/
7795
public static function createSystemCache($namespace, $defaultLifetime, $version, $directory, LoggerInterface $logger = null)
7896
{
7997
if (null === self::$apcuSupported) {

src/Symfony/Component/Cache/Adapter/ApcuAdapter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class ApcuAdapter extends AbstractAdapter
1717
{
1818
use ApcuTrait;
1919

20+
/**
21+
* @param string $namespace
22+
* @param int $defaultLifetime
23+
* @param string|null $version
24+
*
25+
* @throws CacheException if APCu is not enabled
26+
*/
2027
public function __construct($namespace = '', $defaultLifetime = 0, $version = null)
2128
{
2229
$this->init($namespace, $defaultLifetime, $version);

0 commit comments

Comments
 (0)