Commit Graph

22690 Commits

Author SHA1 Message Date
Fabien Potencier
e47d3f1e7b minor #15851 Fix the phpdoc in the CssSelector TranslatorInterface (stof)
This PR was merged into the 2.3 branch.

Discussion
----------

Fix the phpdoc in the CssSelector TranslatorInterface

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

The phpdoc of the interface does not match the behavior of the implementation. And the return type documented by the interface is impossible to return because the interface asks to apply a string prefix, and the only way is to cast the ``XPathExpr`` used internally to a string (which is what the implementation does).

This interface is an internal interface anyway.

Commits
-------

93ffa61 Fix the phpdoc in the CssSelector TranslatorInterface
2015-09-21 07:55:21 +02:00
Ryan Weaver
e353833baf fabbot 2015-09-20 20:45:52 -04:00
Ryan Weaver
dd485f4c13 Adding a new exception and throwing it when the User changes
This is quite technical. As you can see in the provider, the method is called
sometimes when the User changes, and so the token becomes de-authenticated (e.g.
someone else changes the password between requests).

In practice, the user should be unauthenticated. Using the anonymous token did this,
but throwing an AccountStatusException seems like a better idea. It needs to be an
AccountStatusException because the ExceptionListener from the Firewall looks for exceptions
of this class and logs the user out when they are found (because this is their purpose).
2015-09-20 20:44:39 -04:00
Christophe Coevoet
d5abe0b114 [CssSelector] Optimize regexs matching simple selectors 2015-09-21 02:13:44 +02:00
Ryan Weaver
302235e6e5 Fixing a bug where having an authentication failure would log you out.
This solution is a copy of what AbstractAuthenticationListener does. Scenario:

1) Login
2) Go back to the log in page
3) Put in a bad user/pass

You *should* still be logged in after a failed attempt. This commit gives that behavior.
2015-09-20 20:11:34 -04:00
Ryan Weaver
396a1622dc Tweaks thanks to Wouter 2015-09-20 19:51:09 -04:00
Christophe Coevoet
93ffa61e42 Fix the phpdoc in the CssSelector TranslatorInterface 2015-09-21 01:46:31 +02:00
Ryan Weaver
c9d9430913 Adding logging on this step and switching the order - not for any huge reason 2015-09-20 19:43:59 -04:00
Ryan Weaver
31f9caef00 Adding a base class to assist with form login authentication 2015-09-20 19:38:23 -04:00
Ryan Weaver
0501761504 Allowing for other authenticators to be checked
If you have 2 firewalls, 2 GuardAuthenticationProviders are still created, so we need
to be able to run through both of them.
2015-09-20 19:37:51 -04:00
Ryan Weaver
293c8a1775 meaningless author and license changes 2015-09-20 19:37:42 -04:00
Ryan Weaver
81432f9044 Adding missing factory registration 2015-09-20 19:24:22 -04:00
Ryan Weaver
7a94994e8e Thanks again fabbot! 2015-09-20 19:24:22 -04:00
Ryan Weaver
7de05be3f6 A few more changes thanks to @iltar 2015-09-20 19:24:21 -04:00
Ryan Weaver
ffdbc66534 Splitting the getting of the user and checking credentials into two steps
This looks like a subjective change (one more method, but the method implementations are
simpler), but it wasn't. The problem was that the UserChecker checkPreAuth should happen
*after* we get the user, but *before* the credentials are checked, and that wasn't possible
before this change. Now it is.
2015-09-20 19:24:21 -04:00
Ryan Weaver
6edb9e1b06 Tweaking docblock on interface thanks to @iltar 2015-09-20 19:24:21 -04:00
Ryan Weaver
d6937218be Adding periods at the end of exceptions, and changing one class name to LogicException thanks to @iltar 2015-09-20 19:24:21 -04:00
Ryan Weaver
eb158cbdb3 Updating interface method per suggestion - makes sense to me, Request is redundant 2015-09-20 19:24:21 -04:00
Ryan Weaver
c73c32e674 Thanks fabbot! 2015-09-20 19:24:21 -04:00
Ryan Weaver
6c180c78da Adding an edge case - this should not happen anyways 2015-09-20 19:24:21 -04:00
Ryan Weaver
180e2c7878 Properly handles "post auth" tokens that have become not authenticated
Here is the flow:

A) You login using guard and are given a PostAuthGuardToken
B) Your user changes between requests - AbstractToken::setUser() and hasUserChanged() - which
    results in the Token becoming "not authenticated"
C) Something calls out to the security system, which then passes the no-longer-authed
    token back into the AuthenticationProviderManager
D) Because the PostauthGuardToken implements GuardTokenInterface, the provider responds
    to it. But, seeing that this is a no-longer-authed PostAuthGuardToken, it returns
    an AnonymousToken, which triggers logout
2015-09-20 19:24:21 -04:00
Ryan Weaver
873ed284d2 Renaming the tokens to be clear they are "post" and "pre" auth - also adding an interface
The reason is that the GuardAuthenticationProvider *must* respond to *all* tokens
created by the system - both "pre auth" and "post auth" tokens. The reason is that
if a "post auth" token becomes not authenticated (e.g. because the user changes between
requests), then it may be passed to the provider system. If no providers respond (which
was the case before this commit), then AuthenticationProviderManager throws an exception.

The next commit will properly handle these "post auth" + "no-longer-authenticated" tokens,
which should cause a log out.
2015-09-20 19:24:20 -04:00
Ryan Weaver
a0bceb43c9 adding Guard tests 2015-09-20 19:24:20 -04:00
Ryan Weaver
05af97c7f7 Initial commit (but after some polished work) of the new Guard authentication system 2015-09-20 19:24:20 -04:00
Ryan Weaver
330aa7f729 Improving phpdoc on AuthenticationEntryPointInterface so people that implement this understand it 2015-09-20 19:24:20 -04:00
Tobias Schultze
0ad587aec3 minor #15847 [DomCrawler] Optimize the regex used to find namespace prefixes (stof)
This PR was merged into the 2.7 branch.

Discussion
----------

[DomCrawler] Optimize the regex used to find namespace prefixes

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

I ran Blackfire on the [Mink BrowserKitDriver](https://github.com/minkphp/MinkBrowserKitDriver) testsuite (which is a realistic usage of the Mink API btw, as the driver testsuite is basically a functional test of a fixtures website, where failures are considered to be caused by the driver misbehaving).
I discovered that 17% of the time was spent in ``preg_match_all`` to look for prefixes in the XPath namespace prefixes (Mink does not use any namespace prefix in its Xpath queries).

This optimizes the regex to use a possessive quantifier. This avoids useless backtracking when matching (due to the way the regex is written, backtracking cannot allow finding more matches here). See https://blackfire.io/profiles/compare/21aaebf3-e38f-456a-8fc9-cf7d9e2a35eb/graph for the improvement.
The optimization is applied in the 2.7 branch, because this regex does not exist in 2.3: the registration of namespaces was added in 2.4

Commits
-------

02818e4 [DomCrawler] Optimize the regex used to find namespace prefixes
2015-09-21 00:21:34 +02:00
Nicolas Grekas
549f43b03a [Console] Add clock mock to fix transient test on HHVM 2015-09-20 23:33:09 +02:00
Christophe Coevoet
02818e4c92 [DomCrawler] Optimize the regex used to find namespace prefixes 2015-09-20 23:13:58 +02:00
Nicolas Grekas
aa50596345 [VarDumper] Add EnumStub for dumping virtual collections with casters 2015-09-20 23:07:38 +02:00
Nicolas Grekas
2359d4b774 Merge branch '2.8'
* 2.8:
  [Console] Fix whitespaces in fixture

Conflicts:
	src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt
2015-09-19 22:43:38 +02:00
Nicolas Grekas
b1e0bd76c4 Merge branch '2.7' into 2.8
* 2.7:
  [Console] Fix whitespaces in fixture
2015-09-19 22:42:44 +02:00
Nicolas Grekas
f64cf23811 Merge branch '2.3' into 2.7
* 2.3:
  [Console] Fix whitespaces in fixture

Conflicts:
	src/Symfony/Component/Console/Tests/Fixtures/application_asxml1.txt
	src/Symfony/Component/Console/Tests/Fixtures/application_asxml2.txt
2015-09-19 22:42:33 +02:00
Nicolas Grekas
da29357d49 [Console] Fix whitespaces in fixture 2015-09-19 22:40:41 +02:00
Nicolas Grekas
19a9e7e449 Merge branch '2.8'
* 2.8:
  Remove whitespaces between <input> and <label>
  [Translation][File dumper] allow new child classes to implement only formatCatalogue.
  [travis] Remove PHP 7 from allowed failures
  [Translation] Clean whitespaces and EOL in xliff-core-2.0.xsd
  [Finder] Optimize the hot-path
  Update Process.php

Conflicts:
	.travis.yml
	composer.json
	src/Symfony/Bridge/Doctrine/composer.json
2015-09-19 22:03:10 +02:00
Nicolas Grekas
f5d6034311 Merge branch '2.7' into 2.8
* 2.7:
  Remove whitespaces between <input> and <label>
  [travis] Remove PHP 7 from allowed failures
  [Finder] Optimize the hot-path
  Update Process.php
2015-09-19 21:59:50 +02:00
Nicolas Grekas
1ba6cfee48 Merge branch '2.3' into 2.7
* 2.3:
  [travis] Remove PHP 7 from allowed failures
  [Finder] Optimize the hot-path
  Update Process.php

Conflicts:
	composer.json
	src/Symfony/Bridge/Doctrine/composer.json
	src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php
2015-09-19 21:59:23 +02:00
Tobias Schultze
bcb2ff600d minor #15832 [Translation][File dumper] allow new child classes to implement only formatCatalogue (aitboudad)
This PR was merged into the 2.8 branch.

Discussion
----------

[Translation][File dumper] allow new child classes to implement only formatCatalogue

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #15699
| Tests pass?   | yes
| License       | MIT

Commits
-------

5fd9f2f [Translation][File dumper] allow new child classes to implement only formatCatalogue.
2015-09-18 22:35:55 +02:00
Fabien Potencier
72f3fe1470 minor #15836 [Form] fixed something: Remove whitespaces between <input> and <label> (ThomasLandauer)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #15836).

Discussion
----------

[Form] fixed something: Remove whitespaces between <input> and <label>

| Q             | A
| ------------- | ---
| Bug fix?      | [no]
| New feature?  | [no]
| BC breaks?    | [?] What means BC?
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | []
| License       | MIT
| Doc PR        | []

Reason: With the whitespaces, there would be a "gap" between `<input>` and `<label>` which is clickable, but doesn't activate the `<input>`.

It's easy to *add* some margin with CSS, whereas it's impossible to *remove* whitespaces with CSS.

Commits
-------

1b97c17 Remove whitespaces between <input> and <label>
2015-09-18 20:31:45 +02:00
Thomas Landauer
1b97c17c30 Remove whitespaces between <input> and <label>
Reason: With the whitespaces, there would be a "gap" between <input> and <label> which is clickable, but doesn't activate the <input>.

It's easy to *add* some margin with CSS, whereas it's impossible to *remove* whitespaces with CSS.
2015-09-18 20:31:45 +02:00
Fabien Potencier
2e5e601343 minor #15833 [Translation] Clean whitespaces and EOL in xliff-core-2.0.xsd (nicolas-grekas)
This PR was merged into the 2.8 branch.

Discussion
----------

[Translation] Clean whitespaces and EOL in xliff-core-2.0.xsd

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

See https://github.com/symfony/symfony/pull/15833/files?w=1

Commits
-------

630f3b3 [Translation] Clean whitespaces and EOL in xliff-core-2.0.xsd
2015-09-18 20:26:34 +02:00
Abdellatif Ait boudad
5fd9f2f33f [Translation][File dumper] allow new child classes to implement only formatCatalogue. 2015-09-18 14:52:26 +00:00
Tobias Schultze
c4bb79a794 minor #15817 [Process] Stopped Autoruns when shelling on windows (rquadling)
This PR was merged into the 2.3 branch.

Discussion
----------

[Process] Stopped Autoruns when shelling on windows

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

Stop autoruns when shelling on Windows.

Original PR was on https://github.com/symfony/Process/pull/9#issuecomment-140721398.

Commits
-------

bca6771 Update Process.php
2015-09-18 15:09:04 +02:00
Tobias Schultze
b783e40422 minor #15831 [travis] Remove PHP 7 from allowed failures (nicolas-grekas)
This PR was merged into the 2.3 branch.

Discussion
----------

[travis] Remove PHP 7 from allowed failures

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

Looking at the latests PRs, PHP 7 does not segfault anymore with our test suite.

Commits
-------

ba8366e [travis] Remove PHP 7 from allowed failures
2015-09-18 15:05:57 +02:00
Nicolas Grekas
ba8366e208 [travis] Remove PHP 7 from allowed failures 2015-09-18 14:36:19 +02:00
Nicolas Grekas
ac3b17d896 Fix merge 2015-09-18 14:17:38 +02:00
Nicolas Grekas
630f3b30a3 [Translation] Clean whitespaces and EOL in xliff-core-2.0.xsd 2015-09-18 13:01:00 +02:00
Nicolas Grekas
8ad2c38a9f Merge branch '2.8'
* 2.8:
  [Finder] Fix recursive filter iterator
  [Translator][FileDumper] deprecated format method in favor of formatCatalogue.
  bug #15811 use of twig deprecated sameas test
  Improve the structure of the Finder testsuite
  Remove minimum width for web profiler content view
  [VarDumper] Fix HtmlDumper constructor calling CliDumper's
  [Finder] Handle filtering of recursive iterators and use it to skip looping over excluded directories
  Validate the extended type for lazy-loaded type extensions
  Exclude files based on path before applying the sorting
  fixed composer.json
  [Console] fix phpdoc of DialogHelper
  [Translation][Dumper] added XLIFF 2.0 support.
  [XLIFF 2.0] added support for target attributes.
  apply some fixes.
  update changelog.
  [Translation][Loader] added XLIFF 2.0 support.
  Allowed extensions to inline compiler passes

Conflicts:
	UPGRADE-2.8.md
	src/Symfony/Component/Console/Helper/DialogHelper.php
	src/Symfony/Component/Form/composer.json
2015-09-18 12:59:20 +02:00
Fabien Potencier
4e7644c597 bug #15826 [Finder] Optimize the hot-path (nicolas-grekas)
This PR was merged into the 2.3 branch.

Discussion
----------

[Finder] Optimize the hot-path

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

A significant part of the perf gain in #15802 was related to filters not being applied recursively...
#15824 fixing this, performance dropped again.

This PR optimizes the hot path by replacing a regexp test by a simple `isset` when possible.
Blackfire diff after #15824 is the following:
https://blackfire.io/profiles/compare/9e489018-998d-4acb-92a0-46011828e83b/graph

`preg_match` is not called anymore, and  `Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator::current()` is also cut by two.

When this `isset` optimization is disabled and replaced by a concatenation of all the regexps patterns in a single bigger one, the gain is still significant but lower:
https://blackfire.io/profiles/compare/db86b80e-b63e-4fc9-9ff3-9ed32baeb948/graph

This makes me think that an other and last round of optimization is possible by merging all regexps in one in MultiplePcreFilterIterator filters. If someone wants to work on this, please do it :)

Commits
-------

f156de6 [Finder] Optimize the hot-path
2015-09-18 12:01:26 +02:00
Nicolas Grekas
f156de6b71 [Finder] Optimize the hot-path 2015-09-18 11:35:50 +02:00
Nicolas Grekas
c08cf4b7f6 [Finder] Deprecate adapters and related classes 2015-09-18 11:02:33 +02:00