Commit Graph

35505 Commits

Author SHA1 Message Date
Tobias Schultze
4ef0b3e180 feature #26059 [Routing] Match 77.7x faster by compiling routes in one regexp (nicolas-grekas)
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
2018-02-12 23:27:43 +01:00
Nicolas Grekas
f933f70483 [Routing] Match 77.7x faster by compiling routes in one regexp 2018-02-12 23:03:59 +01:00
Nicolas Grekas
882ffe9ee1 Merge branch '4.0'
* 4.0:
  Fix merge
2018-02-12 19:00:32 +01:00
Nicolas Grekas
bc21af22d7 Merge branch '3.4' into 4.0
* 3.4:
  Fix merge
2018-02-12 19:00:17 +01:00
Nicolas Grekas
01ccae828c Fix merge 2018-02-12 19:00:05 +01:00
Nicolas Grekas
aed5991834 Merge branch '4.0'
* 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
2018-02-12 18:55:29 +01:00
Nicolas Grekas
f32a50d369 Merge branch '3.4' into 4.0
* 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
2018-02-12 18:55:14 +01:00
Nicolas Grekas
45145a9f3a Merge branch '2.8' into 3.4
* 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
2018-02-12 18:55:00 +01:00
Nicolas Grekas
245dd72a4d Merge branch '2.7' into 2.8
* 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
2018-02-12 18:44:58 +01:00
Fabien Potencier
a2f7982309 feature #22447 [WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header (ro0NL)
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
2018-02-12 18:43:34 +01:00
Roland Franssen
07dd09db59 [WebProfilerBundle] Imply forward request by a new X-Previous-Debug-Token header 2018-02-12 18:43:33 +01:00
Fabien Potencier
aa3a04ad28 bug #26100 [Routing] Throw 405 instead of 404 when redirect is not possible (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Routing] Throw 405 instead of 404 when redirect is not possible

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Finishes #25962.

Commits
-------

92842814f6 [Routing] Throw 405 instead of 404 when redirect is not possible
2018-02-12 18:42:00 +01:00
Nicolas Grekas
92842814f6 [Routing] Throw 405 instead of 404 when redirect is not possible 2018-02-12 17:45:29 +01:00
Nicolas Grekas
06ab73bc38 feature #26152 [Intl] Add polyfill for Locale::canonicalize() (nicolas-grekas)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Intl] Add polyfill for Locale::canonicalize()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Required after #26069

Commits
-------

972a330 [Intl] Add polyfill for Locale::canonicalize()
2018-02-12 17:35:36 +01:00
Nicolas Grekas
a9f2a0972b bug #26148 [DI] Move "include_once" out of closure factories (nicolas-grekas)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[DI] Move "include_once" out of closure factories

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

They were previously dumped inside the closures.

Commits
-------

bbcd3d7 [DI] Move "include_once" out of closure factories
2018-02-12 17:33:56 +01:00
Nicolas Grekas
972a3306ae [Intl] Add polyfill for Locale::canonicalize() 2018-02-12 17:25:54 +01:00
Nicolas Grekas
72183106cd minor #26150 [Process] fix test case (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Process] fix test case

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

d317496 [Process] fix test case
2018-02-12 15:54:24 +01:00
Nicolas Grekas
d317496b6b [Process] fix test case 2018-02-12 15:35:15 +01:00
Nicolas Grekas
45d288a4ae Add security.tl.xlf to legacy directory 2018-02-12 15:12:46 +01:00
Nicolas Grekas
bbcd3d79ff [DI] Move "include_once" out of closure factories 2018-02-12 15:11:06 +01:00
Fabien Potencier
5a70b153e1 minor #26130 [Security][Validator] Add translations for Tagalog (ergiegonzaga)
This PR was submitted for the master branch but it was squashed and merged into the 2.7 branch instead (closes #26130).

Discussion
----------

[Security][Validator] Add translations for Tagalog

| Q             | A
| ------------- | ---
| Branch?       | master
| 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
-------

60abecafb9 [Security][Validator] Add translations for Tagalog
2018-02-12 13:32:33 +01:00
ergiegonzaga
60abecafb9 [Security][Validator] Add translations for Tagalog 2018-02-12 13:32:32 +01:00
Nicolas Grekas
65b2bcde1b Fix parse error 2018-02-12 08:29:20 +01:00
Fabien Potencier
267bf4c118 bug #26119 [TwigBundle][WebProfilerBundle] Fix JS collision (ro0NL)
This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBundle][WebProfilerBundle] Fix JS collision

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes/no
| Fixed tickets | #25894
| 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
-------

da39e01eb9 [TwigBundle][WebProfilerBundle] Fix JS collision
2018-02-12 08:07:49 +01:00
Fabien Potencier
2f7f9efbc6 fixed typo 2018-02-12 08:05:20 +01:00
Fabien Potencier
6856d8f60c minor #26144 Typo fix in security component translation. (FirstSailor)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #26144).

Discussion
----------

Typo fix in security component translation.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Lithuanian translation typo fix in security component

Commits
-------

a0d8b04f7f Typo fix in security component lithuanian translation.
2018-02-12 08:03:35 +01:00
Rokas Mikalkėnas
a0d8b04f7f Typo fix in security component lithuanian translation. 2018-02-12 08:03:35 +01:00
Fabien Potencier
5bc2753182 feature #26073 [DoctrineBridge] Add support for datetime immutable types in doctrine type guesser (jvasseur)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[DoctrineBridge] Add support for datetime immutable types in doctrine type guesser

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Add support for datetime immutable types in doctrine type guesser now that we support `DateTimeImmutable` input in the form component.

Commits
-------

8c94fef7f2 Add support for immutable types in doctrine type guesser
2018-02-12 07:58:34 +01:00
Fabien Potencier
d418395514 minor #26123 [Workflow] Drop nofooter option in PlantUmlDumper (dead code) (lyrixx)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Workflow] Drop nofooter option in PlantUmlDumper (dead code)

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

---

I also update the test suite: Dumping a worklow with a state machine
dumper does not make sense.

Commits
-------

9b946471e0 [Workflow] Drop nofooter option in PlantUmlDumper (dead code)
2018-02-12 07:57:05 +01:00
Fabien Potencier
0b08f37ed3 bug #26040 [Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25187
| License       | MIT
| Doc PR        | -

Commits
-------

3a470c4ecf [Process] Check PHP_BINDIR before $PATH in PhpExecutableFinder
2018-02-12 07:54:20 +01:00
Nicolas Grekas
7822436b96 Merge branch '4.0'
* 4.0:
  [Bridge/PhpUnit] Fix tests by backporting #25997 to 3.4
2018-02-11 22:41:21 +01:00
Nicolas Grekas
8be6e19236 Merge branch '3.4' into 4.0
* 3.4:
  [Bridge/PhpUnit] Fix tests by backporting #25997 to 3.4
2018-02-11 22:40:43 +01:00
Nicolas Grekas
9a9c0f6142 [Bridge/PhpUnit] Fix tests by backporting #25997 to 3.4 2018-02-11 22:40:17 +01:00
Nicolas Grekas
998531d47f Merge branch '4.0'
* 4.0:
  [Bridge/PhpUnit] fix tests
2018-02-11 19:37:36 +01:00
Nicolas Grekas
6f596c7696 Merge branch '3.4' into 4.0
* 3.4:
  [Bridge/PhpUnit] fix tests
2018-02-11 19:37:31 +01:00
Nicolas Grekas
edd507af78 [Bridge/PhpUnit] fix tests 2018-02-11 19:37:22 +01:00
Nicolas Grekas
e4d683235b Merge branch '4.0'
* 4.0:
  [Bridge/PhpUnit] hotfix
2018-02-11 18:57:15 +01:00
Nicolas Grekas
f75730df46 Merge branch '3.4' into 4.0
* 3.4:
  [Bridge/PhpUnit] hotfix
2018-02-11 18:57:08 +01:00
Nicolas Grekas
292fb56c70 [Bridge/PhpUnit] hotfix 2018-02-11 18:56:58 +01:00
Nicolas Grekas
b292d59f03 Merge branch '4.0'
* 4.0:
  fix merge
2018-02-11 18:30:51 +01:00
Nicolas Grekas
c422bac6b6 Merge branch '3.4' into 4.0
* 3.4:
  fix merge
2018-02-11 18:30:36 +01:00
Nicolas Grekas
c8c27e5434 fix merge 2018-02-11 18:30:10 +01:00
Nicolas Grekas
e81aa7694c Merge branch '4.0'
* 4.0:
  [YAML] Issue #26065: leading spaces in YAML multi-line string literals
  [Bridge\PhpUnit] Exit as late as possible
  [Bridge\PhpUnit] Cleanup BC layer
  [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener
  [Lock] Log already-locked errors as "notice" instead of "warning"
  add context to serialize and deserialize
  Update Repository Symlink Helper
  isCsrfTokenValid() replace string  by ?string
  Document explicitly that dotfiles and vcs files are ignored by default
  [HttpKernel] don't try to wire Request argument with controller.service_arguments
  Make kernel build time optionally deterministic
  Use 0 for unlimited expiry
  [Routing] fix typo
  Bump default PHPUnit version from 6.3 to 6.5
  do not mock the container builder in tests
  [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
2018-02-11 18:18:00 +01:00
Nicolas Grekas
6e34963b3d Merge branch '3.4' into 4.0
* 3.4:
  [YAML] Issue #26065: leading spaces in YAML multi-line string literals
  [Bridge\PhpUnit] Exit as late as possible
  [Bridge\PhpUnit] Cleanup BC layer
  [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener
  [Lock] Log already-locked errors as "notice" instead of "warning"
  add context to serialize and deserialize
  Update Repository Symlink Helper
  Document explicitly that dotfiles and vcs files are ignored by default
  [HttpKernel] don't try to wire Request argument with controller.service_arguments
  Make kernel build time optionally deterministic
  Use 0 for unlimited expiry
  [Routing] fix typo
  Bump default PHPUnit version from 6.3 to 6.5
  do not mock the container builder in tests
  [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
2018-02-11 18:17:44 +01:00
Nicolas Grekas
8ed107d09c Merge branch '2.8' into 3.4
* 2.8:
  [Bridge\PhpUnit] Exit as late as possible
  Update Repository Symlink Helper
  Document explicitly that dotfiles and vcs files are ignored by default
  do not mock the container builder in tests
2018-02-11 18:15:12 +01:00
Nicolas Grekas
e490d663d6 Merge branch '2.7' into 2.8
* 2.7:
  [Bridge\PhpUnit] Exit as late as possible
  Update Repository Symlink Helper
  Document explicitly that dotfiles and vcs files are ignored by default
  do not mock the container builder in tests
2018-02-11 17:53:59 +01:00
Nicolas Grekas
fd1d6d1191 minor #26139 [Bridge\PhpUnit] Cleanup BC layer (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Bridge\PhpUnit] Cleanup BC layer

| 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        | -

Follow up of #26024

Commits
-------

c41681c [Bridge\PhpUnit] Cleanup BC layer
2018-02-11 16:32:58 +01:00
Nicolas Grekas
a23ce690ec bug #26067 [YAML] Issue #26065: leading spaces in YAML multi-line string literals (tamc)
This PR was squashed before being merged into the 3.4 branch (closes #26067).

Discussion
----------

[YAML] Issue #26065: leading spaces in YAML multi-line string literals

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26065
| License       | MIT
| Doc PR        | no

Doing this:

    Yaml::dump(
        ["text" => "  leading space in first line\nno leading space in last line\n"],
        2,
        4,
        Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK
    );

Will produce this:

    text: |
           leading space in first line
         no leading space in last line

Which is invalid YAML because when the first line has leading spaces it needs a [block indentation indicator](http://www.yaml.org/spec/1.2/spec.html#id2793979) like this:

    text: |4
          leading space in first line
        no leading space in last line

This pull requests contains a test and a patch.

Commits
-------

aa95663 [YAML] Issue #26065: leading spaces in YAML multi-line string literals
2018-02-11 16:00:49 +01:00
Thomas Counsell
aa956636ab [YAML] Issue #26065: leading spaces in YAML multi-line string literals 2018-02-11 16:00:48 +01:00
Nicolas Grekas
ec9a109b5d bug #26012 Exit as late as possible (greg0ire)
This PR was merged into the 2.7 branch.

Discussion
----------

Exit as late as possible

People might want to register other shutdown functions that should be
able to control the exit code themselves, without the deprecation error
handler taking over. The php manual says:

> If you call exit() within one registered shutdown function, processing
> will stop completely and no other registered shutdown functions will be
> called.

See https://secure.php.net/manual/en/function.register-shutdown-function.php

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

<!--
- 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
-------

97370a3 [Bridge\PhpUnit] Exit as late as possible
2018-02-11 16:00:08 +01:00