8000 Merge branch '4.0' · dunglas/symfony@cf89857 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf89857

Browse files
Merge branch '4.0'
* 4.0: (23 commits) Add application/ld+json format associated to json [HttpFoundation] Fix false-positive ConflictingHeadersException remove flex-specific suggestion on 3.4 Add check for SecurityBundle in createAccessDeniedException [WebServerBundle] Fix escaping of php binary with arguments Error handlers' $context should be optional as it's deprecated [Serializer] Correct typing mistake in DocBlock [HttpKernel] fix cleaning legacy containers Display n/a for sub-requests time when Stopwatch component is not installed Updating message to inform the user how to install the component [Config] Fix closure CS [Console] Simplify parameters in DI PHP CS Fixer: use PHPUnit Migration ruleset [Process] Skip false-positive test on Windows/appveyor Update MemcachedTrait.php [Bridge/PhpUnit] thank phpunit/phpunit allow auto_wire for SessionAuthenticationStrategy class [Process] Fix setting empty env vars Fixed 'RouterInteface' typo [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions ...
2 parents 07766b3 + 6a69c7f commit cf89857

File tree

29 files changed

+179
-57
lines changed

29 files changed

+179
-57
lines changed

.php_cs.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ return PhpCsFixer\Config::create()
88
->setRules(array(
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
11+
'@PHPUnit48Migration:risky' => true,
12+
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
1113
'array_syntax' => array('syntax' => 'long'),
1214
'protected_to_private' => false,
13-
'php_unit_dedicate_assert' => array('target' => '3.5'),
1415
))
1516
->setRiskyAllowed(true)
1617
->setFinder(

UPGRADE-4.0.md

Lines changed: 2 additions & 2 deletions

Original file line numberDiff line numberDiff line change
@@ -535,11 +535,11 @@ FrameworkBundle
535535
first argument.
536536

537537
* `RouterDebugCommand::__construct()` now requires an instance of
538-
`Symfony\Component\Routing\RouterInteface` as
538+
`Symfony\Component\Routing\RouterInterface` as
539539
first argument.
540540

541541
* `RouterMatchCommand::__construct()` now requires an instance of
542-
`Symfony\Component\Routing\RouterInteface` as
542+
`Symfony\Component\Routing\RouterInterface` as
543543
first argument.
544544
545545
* `TranslationDebugCommand::__construct()` now requires an instance of

src/Symfony/Bridge/PhpUnit/composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"extra": {
4242
"branch-alias": {
4343
"dev-master": "4.1-dev"
44+
},
45+
"thanks": {
46+
"name": "phpunit/phpunit",
47+
"url": "https://github.com/sebastianbergmann/phpunit"
4448
}
4549
}
4650
}

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ CHANGELOG
7575
`Symfony\Component\EventDispatcher\EventDispatcherInterface` as
7676
first argument
7777
* `RouterDebugCommand::__construct()` now takes an instance of
78-
`Symfony\Component\Routing\RouterInteface` as
78+
`Symfony\Component\Routing\RouterInterface` as
7979
first argument
8080
* `RouterMatchCommand::__construct()` now takes an instance of
81-
`Symfony\Component\Routing\RouterInteface` as
81+
`Symfony\Component\Routing\RouterInterface` as
8282
first argument
8383
* `TranslationDebugCommand::__construct()` now takes an instance of
8484
`Symfony\Component\Translation\TranslatorInterface` as

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,16 @@ protected function createNotFoundException(string $message = 'Not Found', \Excep
289289
*
290290
* throw $this->createAccessDeniedException('Unable to access this page!');
291291
*
292+
* @throws \LogicException If the Security component is not available
293+
*
292294
* @final since version 3.4
293295
*/
294296
protected function createAccessDeniedException(string $message = 'Access Denied.', \Exception $previous = null): AccessDeniedException
295297
{
298+
if (!class_exists(AccessDeniedException::class)) {
299+
throw new \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available.');
300+
}
301+
296302
return new AccessDeniedException($message, $previous);
297303
}
298304

src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<service id="security.authentication.session_strategy" class="Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy">
6363
<argument>%security.authentication.session_strategy.strategy%</argument>
6464
</service>
65+
<service id="Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface" alias="security.authentication.session_strategy" />
6566

6667
<service id="security.encoder_factory.generic" class="Symfony\Component\Security\Core\Encoder\EncoderFactory">
6768
<argument type="collection" />

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
} %}
1515
{% endif %}
1616

17+
{% set has_time_events = collector.events|length > 0 %}
18+
1719
{% block toolbar %}
18-
{% set total_time = collector.events|length ? '%.0f'|format(collector.duration) : 'n/a' %}
20+
{% set total_time = has_time_events ? '%.0f'|format(collector.duration) : 'n/a' %}
1921
{% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %}
20-
{% set status_color = collector.events|length and collector.duration > 1000 ? 'yellow' : '' %}
22+
{% set status_color = has_time_events and collector.duration > 1000 ? 'yellow' : '' %}
2123

2224
{% set icon %}
2325
{{ include('@WebProfiler/Icon/time.svg') }}
@@ -75,10 +77,14 @@
7577
<span class="label">Sub-Request{{ profile.children|length > 1 ? 's' }}</span>
7678
</div>
7779

78-
{% set subrequests_time = 0 %}
79-
{% for child in profile.children %}
80-
{% set subrequests_time = subrequests_time + child.getcollector('time').events.__section__.duration %}
81-
{% endfor %}
80+
{% if has_time_events %}
81+
{% set subrequests_time = 0 %}
82+
{% for child in profile.children %}
83+
{% set subrequests_time = subrequests_time + child.getcollector('time').events.__section__.duration %}
84+
{% endfor %}
85+
{% else %}
86+
{% set subrequests_time = 'n/a' %}
87+
{% endif %}
8288

8389
<div class="metric">
8490
<span class="value">{{ subrequests_time }} <span class="unit">ms</span></span>

src/Symfony/Bundle/WebServerBundle/Resources/router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
return false;
3131
}
3232

33-
$script = getenv('APP_FRONT_CONTROLLER') ?: 'index.php';
33+
$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php';
3434

3535
$_SERVER = array_merge($_SERVER, $_ENV);
3636
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script;

src/Symfony/Bundle/WebServerBundle/WebServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ public function isRunning($pidFile = null)
146146
private function createServerProcess(WebServerConfig $config)
147147
{
148148
$finder = new PhpExecutableFinder();
149-
if (false === $binary = $finder->find()) {
149+
if (false === $binary = $finder->find(false)) {
150150
throw new \RuntimeException('Unable to find the PHP binary.');
151151
}
152152

153-
$process = new Process(array($binary, '-S', $config->getAddress(), $config->getRouter()));
153+
$process = new Process(array_merge(array($binary), $finder->findArguments(), array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
154154
$process->setWorkingDirectory($config->getDocumentRoot());
155155
$process->setTimeout(null);
156156

src/Symfony/Bundle/WebServerBundle/WebServerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(string $documentRoot, string $env, string $address =
3232
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env))));
3333
}
3434

35-
putenv('APP_FRONT_CONTROLLER='.$file);
35+
$_ENV['APP_FRONT_CONTROLLER'] = $file;
3636

3737
$this->documentRoot = $documentRoot;
3838
$this->env = $env;

0 commit comments

Comments
 (0)
0