This PR was merged into the 2.7 branch.
Discussion
----------
[HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser.
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | yes (kinda)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Zip files uploaded on Windows often have a mime type of `x-zip-compressed`. This patch adds support for this mime type to `MimeTypeExtensionGuesser`.
The mime type seems to be a valid mime type for zip files according to http://filext.com/file-extension/ZIP
Commits
-------
ba3e19ae21 [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser.
This PR was squashed before being merged into the 2.7 branch (closes#26156).
Discussion
----------
Fixes#26136: Avoid emitting warning in hasParameterOption()
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26136
| License | MIT
| Doc PR | n/a
When hasParameterOption / getParameterOption is passed invalid parameters, a warning may be emitted. While the root cause of the warning is an invalid parameter supplied by the caller, earlier versions of Symfony accepted these parameters, which were effectively ignored.
In the context of these methods, what I mean by "invalid parameter" is an empty string, which is the correct datatype, but is not ever a useful thing to provide to these methods. Since empty strings here did not cause a problem in previous versions, and since Symfony is used by all sorts of projects for all sorts of purposes, it seems best to continue to be flexible about the parameters accepted by Symfony APIs.
Commits
-------
b32fdf1ca3Fixes#26136: Avoid emitting warning in hasParameterOption()
This PR was merged into the 2.7 branch.
Discussion
----------
Added a README entry to the PR template
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | -
| Fixed tickets | -
| License | MIT
| Doc PR | -
Recently, in the [Diversity Initiative post]() @fabpot mentioned: "A major version of a project should be about improving all aspects of it: community, docs, and code in this order of importance." Also, Symfony advocates that [“an undocumented line is a line that does not exist”](https://symfony.com/six-good-reasons).
This order of importance is not yet followed. Most of the resources are spent on the code, instead of the docs. And with good reason: there's a way bigger contributor base to take care of in the code, compared to the docs.
During a doc meeting this evening, @symfony/team-symfony-docs has discussed this problem. We think it can be improved by two pragmatic changes in the Code repository:
* Focus on creating a Doc PR before a feature is merged. We used to do this, but it seems to not be the case anymore.
* Add a `README` section to the PR template, as done by this PR. This readme section should contain a readme focused entry of the feature introduced by the PR. This has multiple advantages, among which: it helps the PR author to focus on usage ([Readme driven development](http://tom.preston-werner.com/2010/08/23/readme-driven-development.html)); it can function as a great bootstrap for the doc team; it helps reviewers to understand the PR more easily.
Of course, I've just created this PR to start the discussion. I'm happy to change all wording in the PR template.
Commits
-------
bc1b652b17 Added a README entry to the PR template
Zip files uploaded on Windows often have a mime type of `x-zip-compressed`. This patch adds support for this mime type to `MimeTypeExtensionGuesser`.
The mime type seems to be a valid mime type for zip files according to http://filext.com/file-extension/ZIP
This PR was merged into the 3.4 branch.
Discussion
----------
Fix undiscoverablility of SymfonyTestsListenerForV7
| Q | A
| ------------- | ---
| Branch? | `3.4@dev` (and `4@dev`)
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | n/a
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
As class is in wrong namespace, it's not discoverable by autoloader and during execution of aliasing we face following crash:
```
ker@dus:~/github/PHP-CS-Fixer λ vendor/bin/phpunit
Class 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7' not found
```
-----------------
replaces #26180, which was wrongly sent (and merged) for `master` branch instead of `3.4`, sorry for mistake.
Commits
-------
538b257 Fix undiscoverablility of SymfonyTestsListenerForV7
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes#26183).
Discussion
----------
[DI] Add null check for removeChild
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
I'm using Symfony 2.8 and PHP Fatal error occurs very rarely when I do assetic:dump / cache:warmup as below.(also on Symfony 2.7)
`
PHP Fatal error: Call to a member function removeChild() on null in .../symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php on line 350
`
It does occur very rarely. Also, after several retries, it works fine.
The xml file which triggers error is as below(both version) and I didn't modify anything.
https://github.com/symfony/swiftmailer-bundle/blob/v2.3.8/Resources/config/swiftmailer.xmlhttps://github.com/symfony/swiftmailer-bundle/blob/v2.6.7/Resources/config/swiftmailer.xml
Once more, error occurs so randomly. So, I can't be sure in what situation it occurs. But this modification does fix the problem and no side effect.
Commits
-------
a5f05a0486 [DI] Add null check for removeChild
This PR was merged into the 3.4 branch.
Discussion
----------
[TwigBridge] Apply some changes to support Bootstrap4-stable
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #25655#25635#24435
| License | MIT
| Doc PR | -
Follow up of https://github.com/symfony/symfony/pull/25715, see discussion there.
This fixes the following errors:
- Delete form-control-label, don't used in Bootstrap 4
- Replace col-form-legend by col-form-label
- Separate the label and input (before the input was in the label)
- Use form-check-inline to put radio and/or checkboxes inline
- Add support of custom form for radio and checkboxes
- Fix input-group: MoneyType (Issue #25655), PercentType
- Remove form-control duplication (Issue #25635)
- Fix Errors in label (#24435)
Commits
-------
14e2282 Fixed broken tests
cf4e956 [TwigBridge] Apply some changes to support Bootstrap4-stable
This PR was merged into the 4.1-dev branch.
Discussion
----------
Fix undiscoverablility of SymfonyTestsListenerForV7
| Q | A
| ------------- | ---
| Branch? | `3.4@dev` (and `4@dev`)
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | n/a
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
As class is in wrong namespace, it's not discoverable by autoloader and during execution of aliasing we face following crash:
```
ker@dus:~/github/PHP-CS-Fixer λ vendor/bin/phpunit
Class 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7' not found
```
Commits
-------
538b257 Fix undiscoverablility of SymfonyTestsListenerForV7
* 4.0:
[Serializer] optims and cleanup
do not mock the container builder in tests
[PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener
fix accessing request values
Avoid running the remove command without any packages
[Form] Add translations for Tagalog
* 3.4:
[Serializer] optims and cleanup
do not mock the container builder in tests
[PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener
fix accessing request values
Avoid running the remove command without any packages
[Form] Add translations for Tagalog
This PR was squashed before being merged into the 2.7 branch (closes#26141).
Discussion
----------
[Serializer] optims and cleanup
| Q | A
| ------------- | ---
| Branch? | 2.7 <!-- see below -->
| Bug fix? | no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | n/a <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | n/a
Tiny optimizations and small code cleanup. The opcode triggering is especially useful in the hot path (normalizers and encoders) because it's a recursive process.
Commits
-------
8ee8387 [Serializer] optims and cleanup
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Validator] support protocolless urls validation
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #24287
| License | MIT
As specified in issue #24287 URL's starting with no protocol but with just `//` are valid URL's and should be accepted by the validator. This pull request fixes the regex used to validate URL's.
Commits
-------
d845406 [Validator] support protocolless urls validation
This PR was merged into the 3.4 branch.
Discussion
----------
do not mock the container builder in tests
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
777acfb do not mock the container builder in tests
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Routing] Handle very large set of dynamic routes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Follow up of #26059; allows handling very long lists of dynamic routes.
Allows running https://github.com/tyler-sommer/php-router-benchmark seamlessly.
BTW, here are the result of running this benchmark:
R3 extension is not loaded. Skipping initialization for "Worst-case matching" test using R3.
R3 extension is not loaded. Skipping initialization for "First route matching" test using R3.
## Worst-case matching
This benchmark matches the last route and unknown route. It generates a randomly prefixed and suffixed route in an attempt to thwart any optimization. 1,000 routes each with 9 arguments.
This benchmark consists of 10 tests. Each test is executed 1,000 times, the results pruned, and then averaged. Values that fall outside of 3 standard deviations of the mean are discarded.
Test Name | Results | Time | + Interval | Change
--------- | ------- | ---- | ---------- | ------
Symfony4 - unknown route (1000 routes) | 995 | 0.0000085699 | +0.0000000000 | baseline
Symfony4 - last route (1000 routes) | 999 | 0.0000086754 | +0.0000001055 | 1% slower
FastRoute - unknown route (1000 routes) | 980 | 0.0000305154 | +0.0000219455 | 256% slower
FastRoute - last route (1000 routes) | 999 | 0.0000529922 | +0.0000444223 | 518% slower
Pux PHP - unknown route (1000 routes) | 972 | 0.0003162730 | +0.0003077032 | 3591% slower
Pux PHP - last route (1000 routes) | 999 | 0.0004376847 | +0.0004291148 | 5007% slower
Aura v2 - unknown route (1000 routes) | 976 | 0.0138277517 | +0.0138191818 | 161253% slower
Aura v2 - last route (1000 routes) | 989 | 0.0138914190 | +0.0138828491 | 161996% slower
## First route matching
This benchmark tests how quickly each router can match the first route. 1,000 routes each with 9 arguments.
This benchmark consists of 5 tests. Each test is executed 1,000 times, the results pruned, and then averaged. Values that fall outside of 3 standard deviations of the mean are discarded.
Test Name | Results | Time | + Interval | Change
--------- | ------- | ---- | ---------- | ------
FastRoute - first route | 999 | 0.0000016928 | +0.0000000000 | baseline
Pux PHP - first route | 999 | 0.0000017381 | +0.0000000453 | 3% slower
Symfony4 - first route | 997 | 0.0000029818 | +0.0000012890 | 76% slower
Aura v2 - first route | 977 | 0.0000376436 | +0.0000359508 | 2124% slower
Commits
-------
ee8b201 [Routing] Handle very large set of dynamic routes
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
6c0e6af [PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener
This PR was merged into the 3.4 branch.
Discussion
----------
[PHPUnit bridge] Avoid running the remove command without any packages
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes/no
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
As the exit code of the command was not checked, the failure was not breaking things, but it was still printing a confusing error message.
This does not apply to versions older than 3.4, as it was impossible to set `SYMFONY_PHPUNIT_REMOVE` to an empty string before (it was applying the default removing rules instead in such case)
Commits
-------
34d2781 Avoid running the remove command without any packages
This PR was merged into the 4.1-dev branch.
Discussion
----------
[DI] Top micro benchmarks
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This makes Symfony rank 1st most of the time, 2nd within the margin error otherwise.
Follow up of https://github.com/kocsismate/php-di-container-benchmarks/pull/21
Commits
-------
3edf5f1 [DI] Top micro benchmarks
This PR was merged into the 2.7 branch.
Discussion
----------
created validator.tl.xlf for Form/Translations
| Q | A
| ------------- | ---
| Branch? | master / 2.7 up to 4.0 for bug fixes <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? |no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | no
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
6d4e5e0 [Form] Add translations for Tagalog
This PR was merged into the 4.1-dev branch.
Discussion
----------
[Routing] Match 77.7x faster by compiling routes in one regexp
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Builds on top of #25961 and http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html to make routing 77.7x faster (measured when matching the last dynamic route of 400 static + 400 dynamic routes.)
More benchs welcomed.
- [x] check static routes first in a switch
- [x] group same-modifiers regexps
- [x] put condition-less routes in a static map, in a switch's "default"
- [x] match host+pathinfo at the same time
- [x] group same-host regexps in sub-patterns
- [x] consider the host to move more static routes in the static switch
- [x] move static single-route "case" to "default" by adding requirements to $routes
- [x] group same-static-prefix in sub-patterns
- [x] group consecutive same-regex in a single "case"
- [x] move dynamic single-route "case" to "default" by adding requirements to $routes
- [x] extract host variables from the main match and remove the current 2nd match
- [x] extend same-prefix grouping to placeholders
- [x] group same-suffix hosts together
Here is my benchmarking code:
```php
<?php
namespace Symfony\Component\Routing;
require 'vendor/autoload.php';
$routes = new RouteCollection();
for ($i = 0; $i < 400; ++$i) {
$routes->add('r'.$i, new Route('/abc'.$i));
$routes->add('f'.$i, new Route('/abc{foo}/'.$i));
}
$dumper = new Matcher\Dumper\PhpMatcherDumper($routes);
eval('?'.'>'.$dumper->dump());
$router = new \ProjectUrlMatcher(new RequestContext());
$i = 10000;
$s = microtime(1);
while (--$i) {
$router->match('/abcdef/399');
}
echo 'Symfony: ', 1000 * (microtime(1) - $s), "\n";
namespace FastRoute;
$dispatcher = simpleDispatcher(function(RouteCollector $r) {
for ($i = 0; $i < 400; ++$i) {
$r->addRoute('GET', '/abc'.$i, 'r'.$i);
$r->addRoute('GET', '/abc{foo}/'.$i, 'f'.$i);
}
});
$i = 10000;
$s = microtime(1);
while (--$i) {
$dispatcher->dispatch('GET', '/abcdef/399');
}
echo 'FastRoute: ', 1000 * (microtime(1) - $s), "\n";
```
Commits
-------
f933f70483 [Routing] Match 77.7x faster by compiling routes in one regexp
* 4.0:
[Routing] Throw 405 instead of 404 when redirect is not possible
[Process] fix test case
Add security.tl.xlf to legacy directory
[Security][Validator] Add translations for Tagalog
fixed typo
Typo fix in security component lithuanian translation.
[TwigBundle][WebProfilerBundle] Fix JS collision
[Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder
* 3.4:
[Routing] Throw 405 instead of 404 when redirect is not possible
[Process] fix test case
Add security.tl.xlf to legacy directory
[Security][Validator] Add translations for Tagalog
fixed typo
Typo fix in security component lithuanian translation.
[TwigBundle][WebProfilerBundle] Fix JS collision
[Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder
* 2.8:
[Routing] Throw 405 instead of 404 when redirect is not possible
[Process] fix test case
Add security.tl.xlf to legacy directory
[Security][Validator] Add translations for Tagalog
fixed typo
Typo fix in security component lithuanian translation.
[Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder
* 2.7:
[Routing] Throw 405 instead of 404 when redirect is not possible
[Process] fix test case
Add security.tl.xlf to legacy directory
[Security][Validator] Add translations for Tagalog
fixed typo
Typo fix in security component lithuanian translation.
[Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder
This PR was squashed before being merged into the 4.1-dev branch (closes#22447).
Discussion
----------
[WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header
| Q | A
| ------------- | ---
| Branch? | 4.1
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
TLDR; imply a "forwarded" request in the profiler if one _returns_ a response with a x-debug-token set. Otherwise dont.
____
Currently a forward request is implied by the WDT/profiler based on the latest sub-request made, however the main request can return it's own response, or one from a non-latest sub-request. The current behavior is a bit misleading imo.
```php
public function indexAction(Request $request)
{
$bar1 = $this->forward(__CLASS__.'::barAction');
$bar2 = $this->forward(__CLASS__.'::bar2Action');
return $bar1;
}
```
It shows the request was forwarded to `bar2Action`. This changes that, so that `barAction` is shown instead. No forward is implied if a new response was returned by `indexAction`.
![image](https://cloud.githubusercontent.com/assets/1047696/25064022/e24d999e-21f1-11e7-8f94-afa3fad7462f.png)
~~Note we dont really need the collector in the framework bundle anymore with this approach.~~ deprecated it.
Commits
-------
07dd09db59 [WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header