Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42e3ecb

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (25 commits) [2.6] link to https://symfony.com where possible Do not override PHP constants, only use when available link to https://symfony.com where possible [FrameworkBundle] Added missing log in server:run command [Finder] Only use GLOB_BRACE when available [HttpFoundation] Allow curly braces in trusted host patterns Fix merge Fix typo in variable name [profiler][security] check authenticated user by tokenClass instead of username. [WebProfiler] fix html syntax for input types [TwigBundle] Fix deprecated use of FlattenException [DependencyInjection] Removed extra strtolower calls Use https://symfony.com/search for searching [Debug] PHP7 compatibility with BaseException [Validator] Fixed Choice when an empty array is used in the "choices" option Fixed tests [StringUtil] Fixed singularification of 'selfies' Fix Portuguese (Portugal) translation for Security improved exception when missing required component [DependencyInjection] resolve circular reference ... Conflicts: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig src/Symfony/Component/Form/README.md src/Symfony/Component/Intl/README.md src/Symfony/Component/Security/README.md src/Symfony/Component/Translation/README.md src/Symfony/Component/Validator/README.md
2 parents 84ba801 + f47d905 commit 42e3ecb

File tree

104 files changed

+327
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+327
-220
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed)
9595
$paramValues = array('value' => $tokenValue,
9696
'lastUsed' => $lastUsed,
9797
'series' => $series,);
98-
$paramTypes = array('value' => \PDO::PARAM_STR,
98+
$paramTypes = array('value' => \PDO::PARAM_STR,
9999
'lastUsed' => DoctrineType::DATETIME,
100100
'series' => \PDO::PARAM_STR,);
101101
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bridge",
44
"description": "Symfony Doctrine Bridge",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bridge",
44
"description": "Symfony Monolog Bridge",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public function __construct()
2626
$this->services =
2727
$this->scopedServices =
2828
$this->scopeStacks = array();
29-
30-
$this->set('service_container', $this);
31-
3229
$this->scopes = array();
3330
$this->scopeChildren = array();
3431
}

src/Symfony/Bridge/ProxyManager/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bridge",
44
"description": "Symfony ProxyManager Bridge",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bridge/Swiftmailer/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bridge",
44
"description": "Symfony Swiftmailer Bridge",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bridge\Twig\Command;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\Console\Command\Command;
1915
use Symfony\Component\Console\Input\InputArgument;
2016
use Symfony\Component\Console\Input\InputInterface;
@@ -205,7 +201,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
205201
}
206202
});
207203

208-
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT));
204+
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
209205

210206
return min($errors, 1);
211207
}

src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function parse(\Twig_Token $token)
5656
if ($stream->test('into')) {
5757
// {% transchoice count into "fr" %}
5858
$stream->next();
59-
$locale = $this->parser->getExpressionParser()->parseExpression();
59+
$locale = $this->parser->getExpressionParser()->parseExpression();
6060
}
6161

6262
$stream->expect(\Twig_Token::BLOCK_END_TYPE);

src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function parse(\Twig_Token $token)
5353
if ($stream->test('into')) {
5454
// {% trans into "fr" %}
5555
$stream->next();
56-
$locale = $this->parser->getExpressionParser()->parseExpression();
56+
$locale = $this->parser->getExpressionParser()->parseExpression();
5757
} elseif (!$stream->test(\Twig_Token::BLOCK_END_TYPE)) {
5858
throw new \Twig_Error_Syntax('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getFilename());
5959
}

src/Symfony/Bridge/Twig/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bridge",
44
"description": "Symfony Twig Bridge",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bundle/DebugBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bundle",
44
"description": "Symfony DebugBundle",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,25 @@ protected function getLockFile($address)
4141
{
4242
return sys_get_temp_dir().'/'.strtr($address, '.:', '--').'.pid';
4343
}
44+
45+
protected function isOtherServerProcessRunning($address)
46+
{
47+
$lockFile = $this->getLockFile($address);
48+
49+
if (file_exists($lockFile)) {
50+
return true;
51+
}
52+
53+
list($hostname, $port) = explode(':', $address);
54+
55+
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
56+
57+
if (false !== $fp) {
58+
fclose($fp);
59+
60+
return true;
61+
}
62+
63+
return false;
64+
}
4465
}

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @author Michał Pipa <[email protected]>
2525
*/
26-
class ServerRunCommand extends ContainerAwareCommand
26+
class ServerRunCommand extends ServerCommand
2727
{
2828
/**
2929
* {@inheritdoc}
@@ -96,15 +96,28 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696
}
9797

9898
$env = $this->getContainer()->getParameter('kernel.environment');
99+
$address = $input->getArgument('address');
100+
101+
if (false === strpos($address, ':')) {
102+
$output->writeln('The address has to be of the form <comment>bind-address:port</comment>.');
103+
104+
return 1;
105+
}
106+
107+
if ($this->isOtherServerProcessRunning($address)) {
108+
$output->writeln(sprintf('<error>A process is already listening on http://%s.</error>', $address));
109+
110+
return 1;
111+
}
99112

100113
if ('prod' === $env) {
101114
$output->writeln('<error>Running PHP built-in server in production environment is NOT recommended!</error>');
102115
}
103116

104-
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $input->getArgument('address')));
117+
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $address));
105118
$output->writeln('Quit the server with CONTROL-C.');
106119

107-
if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env)) {
120+
if (null === $builder = $this->createPhpProcessBuilder($output, $address, $input->getOption('router'), $env)) {
108121
return 1;
109122
}
110123

@@ -131,9 +144,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
131144
return $process->getExitCode();
132145
}
133146

134-
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env)
147+
private function createPhpProcessBuilder(OutputInterface $output, $address, $router, $env)
135148
{
136-
$router = $input->getOption('router') ?: $this
149+
$router = $router ?: $this
137150
->getContainer()
138151
->get('kernel')
139152
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
@@ -154,6 +167,6 @@ private function createPhpProcessBuilder(InputInterface $input, OutputInterface
154167
return;
155168
}
156169

157-
return new ProcessBuilder(array($binary, '-S', $input->getArgument('address'), $router));
170+
return new ProcessBuilder(array($binary, '-S', $address, $router));
158171
}
159172
}

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
167167
}
168168
}
169169

170-
private function isOtherServerProcessRunning($address)
171-
{
172-
$lockFile = $this->getLockFile($address);
173-
174-
if (file_exists($lockFile)) {
175-
return true;
176-
}
177-
178-
list($hostname, $port) = explode(':', $address);
179-
180-
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
181-
182-
if (false !== $fp) {
183-
fclose($fp);
184-
185-
return true;
186-
}
187-
188-
return false;
189-
}
190-
191170
/**
192171
* Determine the absolute file path for the router script, using the environment to choose a standard script
193172
* if no custom router script is specified.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
152152
}
153153
}
154154

155-
if ($input->getOption('output-format') == 'xliff') {
155+
if ($input->getOption('output-format') == 'xlf') {
156156
$output->writeln('Xliff output version is <info>1.2</info>');
157157
}
158158
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\Console\Command\Command;
1915
use Symfony\Component\Console\Input\InputInterface;
2016
use Symfony\Component\Console\Input\InputOption;
@@ -161,7 +157,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
161157
}
162158
});
163159

164-
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT));
160+
$output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
165161

166162
return min($errors, 1);
167163
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

14-
if (!defined('JSON_PRETTY_PRINT')) {
15-
define('JSON_PRETTY_PRINT', 128);
16-
}
17-
1814
use Symfony\Component\DependencyInjection\Alias;
1915
use Symfony\Component\DependencyInjection\ContainerBuilder;
2016
use Symfony\Component\DependencyInjection\Definition;
@@ -174,7 +170,13 @@ protected function describeContainerParameter($parameter, array $options = array
174170
*/
175171
private function writeData(array $data, array $options)
176172
{
177-
$this->write(json_encode($data, (isset($options['json_encoding']) ? $options['json_encoding'] : 0) | JSON_PRETTY_PRINT)."\n");
173+
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
174+
175+
if (defined('JSON_PRETTY_PRINT')) {
176+
$flags |= JSON_PRETTY_PRINT;
177+
}
178+
179+
$this->write(json_encode($data, $flags)."\n");
178180
}
179181

180182
/**

src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@
3434
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_dev.php';
3535

3636
require 'app_dev.php';
37+
38+
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@
3434
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app.php';
3535

3636
require 'app.php';
37+
38+
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class PhpStringTokenParser
5151
{
5252
protected static $replacements = array(
5353
'\\' => '\\',
54-
'$' => '$',
54+
'$' => '$',
5555
'n' => "\n",
5656
'r' => "\r",
5757
't' => "\t",

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bundle",
44
"description": "Symfony FrameworkBundle",
55
"keywords": [],
6-
"homepage": "http://symfony.com",
6+
"homepage": "https://symfony.com",
77
"license": "MIT",
88
"authors": [
99
{
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"name": "Symfony Community",
15-
"homepage": "http://symfony.com/contributors"
15+
"homepage": "https://symfony.com/contributors"
1616
}
1717
],
1818
"require": {

src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
22

33
{% block toolbar %}
4-
{% if collector.user %}
4+
{% if collector.tokenClass %}
55
{% set color_code = (collector.enabled and collector.authenticated) ? 'green' : 'yellow' %}
66
{% set authentication_color_code = (collector.enabled and collector.authenticated) ? 'green' : 'red' %}
77
{% set authentication_color_text = (collector.enabled and collector.authenticated) ? 'Yes' : 'No' %}
88
{% else %}
99
{% set color_code = collector.enabled ? 'red' : 'black' %}
1010
{% endif %}
1111
{% set text %}
12-
{% if collector.user %}
12+
{% if collector.tokenClass %}
1313
<div class="sf-toolbar-info-piece">
1414
<b>Logged in as</b>
1515
<span class="sf-toolbar-status sf-toolbar-status-{{ color_code }}">{{ collector.user }}</span>
@@ -47,7 +47,7 @@
4747

4848
{% block panel %}
4949
<h2>Security</h2>
50-
{% if collector.user %}
50+
{% if collector.tokenClass %}
5151
<table>
5252
<tr>
5353
<th>Username</th>

0 commit comments

Comments
 (0)