Commit Graph

39967 Commits

Author SHA1 Message Date
Grégoire Paris
9df76ebbe5
Extract closures into static functions 2019-01-27 18:08:35 +01:00
Nicolas Grekas
cd4b031b7e minor #29777 [VarDumper] Improve performance of AbstractCloner (javiereguiluz)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[VarDumper] Improve performance of AbstractCloner

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | -

While profiling Symfony in "dev" environment (see #29762) I found that `VarCloner::addCasters()` was making thousands of `strtolower()` calls.

![varcloner-addcasters](https://user-images.githubusercontent.com/73419/50694461-40a1bd80-103a-11e9-83c0-a28b8f8f161e.png)

In this PR I propose to remove all those calls. I think it's possible to do it ... but I could be completely wrong, so please review.

-----

As a side note, in the past we did the same `strtolower()` to service IDs and parameter names. We stopped doing that in Symfony 3.3 and it gave us a small performance improvement (same as we could gain here).

If the `strtolower()` calls of `VarCloner::addCasters()` are made just to apply the caster even if the class name is wrongly spelled, I think we could make this change. My guess is that nothing would break for the user (unlike removing the `strtolower()` in DependencyInjection, which broke wrongly spelled services and params). Thanks!

Commits
-------

cff23e52bf [VarDumper] Improve performance of AbstractCloner
2019-01-25 13:15:01 +01:00
Javier Eguiluz
cff23e52bf [VarDumper] Improve performance of AbstractCloner 2019-01-25 13:12:05 +01:00
Nicolas Grekas
a25daa8bd8 bug #29770 [Routing] Make important parameters required when matching (vudaltsov)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Routing] Make important parameters required when matching

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/29763
| License       | MIT
| Doc PR        | n/a

1. This PR improves "important" route parameters implementation. Instead of considering `!slug` to be a variable name (which is not correct from my POV and leads to a lot of `'!' === $varName[0]` and `substr($varName, 1)` snippets), I took advantage of the `$token` array and used offset `[5]` for keeping boolean importance flag. This approach improved and simplified code.
1. This PR makes important parameters required when matching according to https://github.com/symfony/symfony/issues/29763

Commits
-------

2c3ab22080 Made important parameters required when matching
2019-01-25 11:59:33 +01:00
Nicolas Grekas
9876e3a6fe feature #29861 [Form][TwigBridge] Add help_html (mpiot)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form][TwigBridge] Add help_html

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

Sometimes, when we use the form `help` option, we want to display it as HTML (add bold, italic, a span with a specific class, ...). For security reasons, we escape the `help` content.

In this PR, I've added an `help_html` option, seted to false per default. When it set on true, the `help` content is no longer escaped.

Commits
-------

33f5f855d6 [Form][TwigBridge] Add help_html option
2019-01-25 11:39:19 +01:00
Mathieu Piot
33f5f855d6 [Form][TwigBridge] Add help_html option 2019-01-25 11:36:18 +01:00
Nicolas Grekas
edc4a0f572 feature #29968 [DI] Added support for deprecating aliases (j92, Renan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Added support for deprecating aliases

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

This PR is a continuity of #24707

Commits
-------

6c571adda7 Added support for deprecating aliases (runtime+dumper)
0eb071b9f8 Added support for deprecating an alias
2019-01-25 10:57:49 +01:00
Nicolas Grekas
0901bbe18d bug #29975 [Mime] fix adding extensions when creating a MimeTypes instance (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Mime] fix adding extensions when creating a MimeTypes instance

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

Commits
-------

6c7d03431c [Mime] fix adding extensions when creating a MimeTypes instance
2019-01-25 10:56:29 +01:00
Renan
6c571adda7 Added support for deprecating aliases (runtime+dumper) 2019-01-25 10:36:47 +01:00
Valentin
2c3ab22080 Made important parameters required when matching 2019-01-25 10:55:44 +03:00
Nicolas Grekas
8edddfa3dc Merge branch '4.2'
* 4.2:
  [Process] disable transient test on Windows
  Enable PHP 7.3 on Travis
2019-01-24 23:35:38 +01:00
Nicolas Grekas
25f9ec6a54 Merge branch '4.1' into 4.2
* 4.1:
  Enable PHP 7.3 on Travis
2019-01-24 23:35:26 +01:00
Nicolas Grekas
343d24dc0c Merge branch '3.4' into 4.1
* 3.4:
  Enable PHP 7.3 on Travis
2019-01-24 23:33:25 +01:00
Nicolas Grekas
a5dd57f5e5 minor #29979 Enable PHP 7.3 on Travis (tvlooy)
This PR was merged into the 3.4 branch.

Discussion
----------

Enable PHP 7.3 on Travis

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

The bits of #29624 that apply to 3.4.

Commits
-------

335036cf09 Enable PHP 7.3 on Travis
2019-01-24 23:27:38 +01:00
Nicolas Grekas
289389879a minor #29965 Dont advertize what symfony/symfony "provides" (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Dont advertize what symfony/symfony "provides"

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

No need to maintain not advertize this IMHO.

Commits
-------

e8a7a0e2fc Dont advertize what symfony/symfony "provides"
2019-01-24 23:19:30 +01:00
Nicolas Grekas
adf1e6f65a minor #29980 [Process] disable transient test on Windows (nicolas-grekas)
This PR was merged into the 4.2 branch.

Discussion
----------

[Process] disable transient test on Windows

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

This test makes our Windows CI red 80% of the time, let's disable it until someone can have a deeper look.
PIng @Nek- , help wanted.

Commits
-------

399fee64f8 [Process] disable transient test on Windows
2019-01-24 23:13:27 +01:00
Nicolas Grekas
399fee64f8 [Process] disable transient test on Windows 2019-01-24 23:05:03 +01:00
Nicolas Grekas
e8a7a0e2fc Dont advertize what symfony/symfony "provides" 2019-01-24 23:02:27 +01:00
Tom Van Looy
335036cf09 Enable PHP 7.3 on Travis 2019-01-24 22:57:19 +01:00
Nicolas Grekas
d8af8b6edd Merge branch '4.2'
* 4.2:
  Bump phpunit bridge cache id
  [appveyor] fix create-project phpunit
  Fix HttpKernel Debug requirement
  Fix heredoc
  use final annotation to allow mocking the class
  synchronise the form builder docblock
  Grammar fix in exception message
  fix tests
  forward the parse error to the calling code
  Avoid dots in generated class names.
  [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends
  ensure compatibility with older PHPUnit mocks
  [Security] Do not mix usage of password_*() functions and sodium_*() ones
2019-01-24 22:40:22 +01:00
Nicolas Grekas
61bf16c71d Merge branch '4.1' into 4.2
* 4.1:
  Bump phpunit bridge cache id
  [appveyor] fix create-project phpunit
  Fix HttpKernel Debug requirement
  Fix heredoc
  use final annotation to allow mocking the class
  synchronise the form builder docblock
  Grammar fix in exception message
  fix tests
  forward the parse error to the calling code
  [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends
  ensure compatibility with older PHPUnit mocks
  [Security] Do not mix usage of password_*() functions and sodium_*() ones
2019-01-24 22:39:51 +01:00
Nicolas Grekas
aff17e2cc4 Merge branch '3.4' into 4.1
* 3.4:
  Bump phpunit bridge cache id
  [appveyor] fix create-project phpunit
  Fix HttpKernel Debug requirement
  Fix heredoc
  use final annotation to allow mocking the class
  synchronise the form builder docblock
  Grammar fix in exception message
  fix tests
  forward the parse error to the calling code
  [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends
  ensure compatibility with older PHPUnit mocks
  [Security] Do not mix usage of password_*() functions and sodium_*() ones
2019-01-24 22:39:39 +01:00
Nicolas Grekas
ebed00f65c Bump phpunit bridge cache id 2019-01-24 22:33:33 +01:00
Nicolas Grekas
aad0c58d6c [appveyor] fix create-project phpunit 2019-01-24 22:26:46 +01:00
Nicolas Grekas
68d84d11a1 bug #29920 [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends

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

Currently, when there is no comment for a tag and another tag after, the detection does not work. Example :
```php
/**
 * @final
 *
 * @author John
 */
class A {

}
```

AFAIK, those tags must not be in a specific order. That's why we should try to support more cases because we might miss things to report.

Also I do not understand why the regex is not the same for the classes and methods detection. I fixed that too.

I added a lot of cases in the "extends from final class" test and an easy way to add more when needed. Adding them everywhere might be overkill and useless. WDYT ?

I'm considering this as bug fix.

Commits
-------

c3b670a908 [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends
2019-01-24 22:19:05 +01:00
Nicolas Grekas
14d458d0dc feature #29850 [FrameworkBundle] xliff-version option to translation update command (andrewwro)
This PR was squashed before being merged into the 4.3-dev branch (closes #29850).

Discussion
----------

[FrameworkBundle] xliff-version option to translation update command

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| License       | MIT

New 'version' option added to xliff translation update command. Currently xliff version is hardcoded to 1.2.

Commits
-------

4ec28bd45d [FrameworkBundle] xliff-version option to translation update command
2019-01-24 21:08:18 +01:00
Andrzej
4ec28bd45d [FrameworkBundle] xliff-version option to translation update command 2019-01-24 21:08:11 +01:00
Nicolas Grekas
6c7d03431c [Mime] fix adding extensions when creating a MimeTypes instance 2019-01-24 19:14:26 +01:00
Joost van Driel
0eb071b9f8 Added support for deprecating an alias 2019-01-23 15:43:53 +01:00
Fabien Potencier
ccf6223c7a minor #29964 [HttpKernel] Fix HttpKernel Debug requirement (jvasseur)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Fix HttpKernel Debug requirement

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

The `LoggerDataCollector` is using the `SilencedErrorContext` class that doesn't exists before Symfony 3.2

Commits
-------

69feb49c0d Fix HttpKernel Debug requirement
2019-01-23 15:15:26 +01:00
Jérôme Vasseur
69feb49c0d Fix HttpKernel Debug requirement 2019-01-23 14:37:11 +01:00
Fabien Potencier
0c323028d2 minor #29954 [Form] synchronise the form builder docblock (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] synchronise the form builder docblock

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

419d3db86c synchronise the form builder docblock
2019-01-23 14:02:34 +01:00
Fabien Potencier
d760c27909 minor #29960 Fix heredoc (Stadly)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix heredoc

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

A heredoc was erroneously a nowdoc.

Commits
-------

15f5f69b1d Fix heredoc
2019-01-23 13:58:53 +01:00
Robin Chalas
47b739cba2 minor #29955 [Security] use final annotation to allow mocking the class (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] use final annotation to allow mocking the class

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

When the class was initially marked as `final`, it did only contain constants. Since #24337 the `Security` class also contains useful shortcut methods so allowing developers to mock the class in tests looks reasonable to me.

Commits
-------

1da00db247 use final annotation to allow mocking the class
2019-01-23 12:22:36 +01:00
Stadly
15f5f69b1d Fix heredoc 2019-01-23 09:53:40 +01:00
Christian Flothmann
1da00db247 use final annotation to allow mocking the class 2019-01-22 15:51:10 +01:00
Christian Flothmann
419d3db86c synchronise the form builder docblock 2019-01-22 15:49:00 +01:00
Fabien Potencier
a9f8ca57af minor #29942 [HttpFoundation] Add missing changelog/upgrade notes (chalasr)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpFoundation] Add missing changelog/upgrade notes

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

Commits
-------

a44f19c5f1 [HttpFoundation] Add missing changelog/upgrade notes
2019-01-21 15:47:50 +01:00
Fabien Potencier
aca3d2c90d minor #29868 Grammar fix in exception message (michaelKaefer)
This PR was merged into the 3.4 branch.

Discussion
----------

Grammar fix in exception message

According to https://en.wiktionary.org/wiki/whitespace and https://english.stackexchange.com/questions/25368/what-is-the-plural-form-of-whitespace valid sentences would be:
- Whitespace is ...
- Whitespaces are ...
- Whitespace characters are ...

But this is not correct:
- Whitespace are ...

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

Commits
-------

6e279a006b Grammar fix in exception message
2019-01-21 15:45:47 +01:00
Michael Käfer
6e279a006b Grammar fix in exception message
According to https://en.wiktionary.org/wiki/whitespace and https://english.stackexchange.com/questions/25368/what-is-the-plural-form-of-whitespace valid sentences would be:
- Whitespace is ...
- Whitespaces are ...
- Whitespace characters are ...

But this is not correct:
- Whitespace are ...
2019-01-21 14:02:53 +01:00
Robin Chalas
a44f19c5f1 [HttpFoundation] Add missing changelog/upgrade notes 2019-01-20 19:14:21 +01:00
Fabien Potencier
5e9373bf18 minor #29937 [DependencyInjection] fix tests (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection] fix tests

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

My changes in #29928 broke the test suite.

Commits
-------

4db0a6e099 fix tests
2019-01-20 14:03:26 +01:00
Christian Flothmann
4db0a6e099 fix tests 2019-01-20 09:34:00 +01:00
Fabien Potencier
333b544d8b minor #29928 [DependencyInjection] forward the parse error to the calling code (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection] forward the parse error to the calling code

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

This change does not fully solve the linked issue, but improves the exception a bit by providing a bit more context.

The error page will no start like this:

![bildschirmfoto 2019-01-18 um 12 28 14](https://user-images.githubusercontent.com/1957048/51384558-f7af3600-1b1c-11e9-9744-a40c41c821ce.png)

Commits
-------

c5c2d31fef forward the parse error to the calling code
2019-01-20 09:19:46 +01:00
Christian Flothmann
c5c2d31fef forward the parse error to the calling code 2019-01-20 09:08:17 +01:00
Fabien Potencier
5564d73854 bug #29922 Avoid dots in generated class names (derrabus)
This PR was merged into the 4.2 branch.

Discussion
----------

Avoid dots in generated class names

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

This PR removes dots from class names containers generated out of anonymous kernel classes.

Commits
-------

52c80e6cf2 Avoid dots in generated class names.
2019-01-20 08:24:41 +01:00
Alexander M. Turek
52c80e6cf2 Avoid dots in generated class names. 2019-01-19 17:51:40 +01:00
Robin Chalas
b972d15d52 bug #29863 [Security] Do not mix password_*() API with libsodium one (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Do not mix password_*() API with libsodium one

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

Argon2IPasswordEncoder uses native `password_hash()` and `password_verify()` functions if the current PHP installation embeds Argon2 support (>=7.2, compiled `--with-password-argon2`).
Otherwise, it fallbacks to the libsodium extension.

This was fine at time the encoder was introduced, but meanwhile libsodium changed the algorithm used by `sodium_crypto_pwhash_str()` which is now argon2id, that goes outside of the scope of the encoder which was designed to deal with `argon2i` only.
Nothing we can do as databases may already contain passwords hashed with argon2id, the encoder must keep validating those.

However, the PHP installation may change as time goes by, and could suddenly embed the Argon2 core integration. In this case, the encoder would use the `password_verify()` function which would fail in case the password was not hashed using argon2i.
This PR prevents it by detecting that argon2id was used, avoiding usage of `password_verify()`.

See https://github.com/jedisct1/libsodium-php/issues/194 and https://github.com/symfony/symfony/issues/28093 for references.
Patch cannot be tested as it is platform dependent.

Side note: I'm currently working on a new implementation for 4.3 that will properly supports argon2id (which has been added to the PHP core sodium integration in 7.3) and argon2i, distinctively.

Commits
-------

d6cfde94b4 [Security] Do not mix usage of password_*() functions and sodium_*() ones
2019-01-18 19:41:49 +01:00
Thomas Calvet
c3b670a908 [Debug][DebugClassLoader] Match more cases for final, deprecated and internal classes / methods extends 2019-01-17 18:28:22 +01:00
Fabien Potencier
e231edd5dc minor #29914 ensure compatibility with older PHPUnit mocks (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

ensure compatibility with older PHPUnit mocks

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

Commits
-------

b714419faf ensure compatibility with older PHPUnit mocks
2019-01-17 14:52:57 +01:00