This PR was squashed before being merged into the 4.3-dev branch (closes#30450).
Discussion
----------
[Profiler] Render the performance graph with SVG
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | Part 1, 3 and 4 of #27262
| License | MIT
| Doc PR | n/a
Following a suggestion by @ogizanagi in #27262,
Here's a proposal to render the Request Graph, from the performance profiler panel, with SVG instead of canvas.
Some benefits of the SVG format:
- The text labels are searchable and can be selected.
- It renders well on high DPI monitors.
- [Colors and text styles](https://github.com/symfony/symfony/issues/27262#issuecomment-388868068) can be defined with CSS just like the rest of the page.
In addition, SVG allow us to consider (and easily implement) interactives features such as:
- Zoom in and time navigation (thanks to the viewport).
- Highlight hovered line (or other DOM related events).
Preview:
![screenshot_2019-03-08 symfony profiler 1](https://user-images.githubusercontent.com/1846873/54036727-a33f4300-41bc-11e9-8be7-b1de10d4afd9.png)
Filtered events example:
![capture d ecran 2019-03-08 a 17 22 47](https://user-images.githubusercontent.com/1846873/54041039-00d88d00-41c7-11e9-9590-23e809415c34.png)
### Progress :
- [x] Render request events in SVG
- [x] Show labels with duration and memory
- [x] Show specific markers at start / end of lines
- [x] Re-render graph when window resize
- [x] Re-render graph when threshold change.
- [x] Generate graph legend with only existing categories (part 1. of #27262 )
- [x] Show sub-request area with hatched pattern
- [x] Allow to hide categories by clicking them on the legend (part 3. of #27262 )
- [x] Handle text overflow on long labels.
- [x] Ensure JS code is compatible with all supported browsers (used [classes](https://caniuse.com/#feat=es6-class) and [arrow functions](https://caniuse.com/#feat=arrow-functions).
- ~Add left-padding to sub-request graph?~
Commits
-------
a69a718ec9 [Profiler] Render the performance graph with SVG
This PR was squashed before being merged into the 4.3-dev branch (closes#30549).
Discussion
----------
[HttpClient] Make exceptions public
| 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 | n/a
Makes it easier to implement the interface. See api-platform/core#2608
Commits
-------
928d774e4a [HttpClient] Make exceptions public
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Serializer] Normalize constraint violation parameters
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- 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 | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A?
Adding violation constraints' parameters to the normalized data, as these are valuable for an API client.
I used `parameters` for now, as it's the name used in `ConstraintViolationInterface::getParameters()`, but what about `placeholders` or `context`?
Commits
-------
32c90ebc8e [Serializer] Normalize constraint violation parameters
This PR was squashed before being merged into the 4.3-dev branch (closes#28330).
Discussion
----------
[MonologBridge] Add monolog processors adding route and command info
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | symfony/symfony-docs#10244
This PR adds two simple processors that add context to every log entry.
RouteProcessor adds routing information:
`app.INFO: Some log text {"someContext":"ctx"} {"route":{"controller":"App\\Controller\\SomeController::number","route":"index","route_params":[]}`
ConsoleCommandProcessors adds current command information:
`app.INFO: Some log text {"someContext":"ctx"} {"command":{"name":"app:some-command","arguments":{"command":"app:some-command","some-argument":10}}}`
For ConsoleCommandProcessor I've decided against including command options by default, because there's a lot of default ones:
`"options":{"help":false,"quiet":false,"verbose":false,"version":false,"ansi":false,"no-ansi":false,"no-interaction":false,"env":"dev","no-debug":false}`. This behavior can be changed with a constructor argument.
Commits
-------
669f6b2726 [MonologBridge] Add monolog processors adding route and command info
This PR was merged into the 3.4 branch.
Discussion
----------
[Intl] Add compile binary
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no-ish
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Compile the Intl data by invoking a single command, and make it work out-of-the-box. (Split from #28831)
```bash
$ src/Symfony/Component/Intl/Resources/bin/compile
```
run in repository root because of
b7e798ef74/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php (L141)
3.4 is ok, 4.2 is not because of #28833 but new locales are introduced in https://github.com/symfony/symfony/pull/28977/files#diff-f52da32e1ee6b93598814090d0749aa6R1
So as long as 3.4 is supported, but branches above add filters etc. during generation we're risking this discrepancy. I suggest after merge in upper branches to re-run `compile` (potential for automating, but run if needed :))
Commits
-------
426b92f4a8 [Intl] Add compile binary
* 4.2:
Fix Cache error while using anonymous class
[Cache] fix LockRegistry
Update validators.cs.xlf
Make translations consistent with other translations.
Correct language code for ukrainian language in security translations.
Fix return type of Request::getRequestFormat
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DependencyInjection] Add ability to define an index for service in an injected service locator argument
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | in progress / symfony/symfony-docs#...
It's more or less the same thing then the PR #30257 but for a service locator argument
Add a simple way to specify an index based on a tag attribute to simplify retrieving a specific service when injecting a service locator as argument into services, but also a way to fallback to a static method on the service class.
Yaml:
```yaml
services:
foo_service:
class: Foo
tags:
- {name: foo_tag, key: foo_service}
foo_service_tagged:
class: Bar
arguments:
- !tagged_locator
tag: 'foo_tag'
index_by: 'key'
default_index_method: 'static_method'
```
XML:
```xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/serviceshttp://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="foo" class="Foo">
<tag name="foo_tag" key="foo_service" />
</service>
<service id="foo_tagged_iterator" class="Bar" public="true">
<argument type="tagged_locator" tag="foo_tag" index-by="key" default-index-method="static_method" />
</service>
</services>
</container>
```
PHP:
```php
// config/services.php
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
$container->register(Foo::class)
->addTag('foo_tag', ['key' => 'foo_service']);
$container->register(App\Handler\HandlerCollection::class)
// inject all services tagged with app.handler as first argument
->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('app.handler', 'key')));
```
Usage:
```php
// src/Handler/HandlerCollection.php
namespace App\Handler;
use Symfony\Component\DependencyInjection\ServiceLocator;
class HandlerCollection
{
public function __construct(ServiceLocator $serviceLocator)
{
$foo = $serviceLocator->get('foo_service'):
}
}
```
Tasks
* [x] Support PHP loader/dumper
* [x] Support YAML loader/dumper
* [x] Support XML loader/dumper (and update XSD too)
* [x] Add tests
* [x] Documentation
Commits
-------
cb3c56bc0c Support indexing tagged locators by FQCN as fallback
250a2c8332 [DI] Allow tagged_locator tag to be used as an argument
This PR was squashed before being merged into the 4.3-dev branch (closes#30469).
Discussion
----------
Create a hyperlink to interfaces/classes that can be autowired
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Added hyperlink to definition of interfaces/classes that can be used for autowiring.
But I need help with:
- the aliases are becoming hyperlinks too, but shouldn't.
It's outputting `<fg=yellow;href=phpstorm://open?file=filepath&line=17>Symfony\Contracts\Translation\TranslatorInterface</> <fg=cyan>(translator.default)</>`
- it currently works with phpstorm because it's hardcoded but it should work with framework.ide option, but don't know what the best approach is to support that config option.
Commits
-------
a3dfcee406 Create a hyperlink to interfaces/classes that can be autowired
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] add ReverseContainer: a locator that turns services back to their ids
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR introduces a `ReverseContainer`, which is a class you can type hint for to get it as a service.
When you have a `ReverseContainer` at hand, you can then use it to know the service id of an object (if the object is not found, `null` is returned):
`$id = $reverseContainer->getId($someObject);`
You can also call `$reverseContainer->getService($id);` and get the service in return.
To be reversible, a service must either be public or be tagged with `container.reversible`.
I'm using this feature to serialize service references in a message, then send them through a Messenger bus, allowing the handler on the other side to use that referenced service to process the message. More specifically, my use case is sending messages for early cache expiration events through a bus and have a worker compute the soon-to-expire value in the background. The reversible services are the computation callbacks and the cache pools I need to compute the value for.
Commits
-------
ac1e4291e8 [DI] add ReverseContainer: a locator that turns services back to their ids
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Discussing with @simensen, we figured out the currently logged messages are not precise enough.
Logging is a cross-cutting concern: splitting it in a dedicated middleware means losing details - or building complexity.
Let's make things simple and log the best messages depending on the internal situation.
While the component is experimental, removing the `LoggingMiddleware` altogether would break FrameworkBundle 4.2 when it is used with Messenger 4.3. Not worth the trouble when it's two lines to deprecate IMHO.
Commits
-------
2bff625abe [Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
This PR was squashed before being merged into the 4.3-dev branch (closes#30547).
Discussion
----------
[HttpClient] Add new bearer option
| 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? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | n/a
Add a new "auth_bearer" option to set the corresponding flavor of the `Authorization` header as defined in RFC 6750 and used in OAuth (and others).
Also rename "auth" to "auth_basic" for consistency as discussed with @nicolas-grekas.
Commits
-------
f79ef21458 [HttpClient] Add new bearer option
* 3.4:
Make translations consistent with other translations.
Correct language code for ukrainian language in security translations.
Fix return type of Request::getRequestFormat
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 3.4 branch.
Discussion
----------
Correct language code for ukrainian language
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Correct language code for [ukrainian language](https://en.wikipedia.org/wiki/Ukrainian_language) is **uk**, not **ua**. Similar bug was earlier addressed in #5972, but somehow it appeared here again. Possible BC break in case someone relies on "ua" version being present, but I think that is a minor problem.
Commits
-------
b86fa9312b Correct language code for ukrainian language in security translations.
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Improve Bulgarian translations.
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| 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 | none <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | none <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
This pull request is an improvement on top of #30227 and improves translations in the following ways:
- Make consistent how `This` word is translated.
- Make consistent how `This value` is translated.
- Fix capitalization rules for abbreviations.
- Change `email` to `имейл` (this is a word in the official Bulgarian dictionary).
- Removes unnecessary words in brackets.
Feel free to comment and criticize I'm not a professional translator.
Commits
-------
d15c76cd53 Make translations consistent with other translations.
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
This is slimmed down version of: https://github.com/symfony/symfony/pull/28269 _(many of the fixes there are already part of 3.4)_
Does:
- Adds test coverage for Predis with RedisCluster
- Removes usage of key versioning when on RedisCluster, besides performance aspect of that it simplifies / aligning clear() handling across all clients
- reuse doDelete() from clear to make sure we call singular del calls when in predis cluster
Commits
-------
dacf17962b [Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Form] Fix debug form when using partial type name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
Since https://github.com/symfony/symfony/pull/29452 (4.3) we have the possibility of passing a partial type name. This fixes the case where `debug:form dateTime` doesn't work as expected:
```bash
In FormRegistry.php line 89:
[Symfony\Component\Form\Exception\InvalidArgumentException]
Could not load type "dateTime": class does not implement "Symfony\Component\Form\FormTypeInterface".
```
Commits
-------
22b20cab10 Fix debug:form dateTime
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
---
Just some cleaning. See
https://github.com/symfony/symfony/pull/29146#issuecomment-44418654
Commits
-------
a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
This PR was merged into the 4.3-dev branch.
Discussion
----------
[BrowserKit] Rename Client to Browser
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
`Client` is very generic and used in 3 places: BrowserKit, HttpKernel, and FramewrokBundle. Each Client extends another one. So, to make things clearer, I'd like to rename Client to Browser like this:
Symfony\Component\BrowerKit\Client -> AbstractBrowser
Symfony\Component\HttpKernel\Client -> HttpKernelBrowser
Symfony\Bundle\FrameworkBundle\Client -> KernelBrowser
The next PR will introduce an `HttpBrowser` based on the new HttpClient component :)
Commits
-------
dbe4f8605b renamed Client to Browser
This PR was merged into the 4.2 branch.
Discussion
----------
[Messenger] Fix README about BC promise
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We don't have a BC *break* policy :)
Should be applied to MIME and HttpClient when merging into master.
Commits
-------
9b2af69403 Fix README about BC promise
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] yield a last chunk for completed responses also
| 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 | -
When a response completed, streaming it again yields no chunks right now.
This PR makes it yield a `LastChunk` - or an `ErrorChunk` when applicable.
The reasoning for the previous behavior was that streams should yield only activity from the network.
But this looks more complex to use in practice. The proposed behavior is simpler to reason about I think.
Commits
-------
e11ef7ed12 [HttpClient] yield a last chunk for completed responses also
* 4.2:
[Cache] Only delete one key at a time when on Predis + Cluster
[Validator] Add missing translations for Swedish locale
[Process] fix using argument $php of new PhpProcess()
[Routing] removed a useless var
[Routing] Fixed XML options resolution
This is slimmed down version of: https://github.com/symfony/symfony/pull/28269 _(many of the fixes here are already part of 3.4)_
Adds:
- Test coverage for Predis with RedisCluster
- Removes usage of key versioning when on RedisCluster, besides performance aspect of that simplify / aligning clear() handling across cases
* 3.4:
[Cache] Only delete one key at a time when on Predis + Cluster
[Validator] Add missing translations for Swedish locale
[Routing] removed a useless var
[Routing] Fixed XML options resolution
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache] Only delete one key at a time when on Predis + Cluster
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Makes sure deletes when on Predis Cluster is only done one by one as it's not able to send the keys to right cluster node like RedisCluster can.
_This is backport of logic from 4.x to fix this. With one tweak; make sure to only do this when on cluster so not all Predis users pay the penalty for it._
Commits
-------
f5ece20a83 [Cache] Only delete one key at a time when on Predis + Cluster
This PR was merged into the 3.4 branch.
Discussion
----------
[Routing] Fixed XML options resolution
| 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 | ~
Found this bug while adding tests in #30501. I need it to be merged upward so it can get green there.
Thanks!
Commits
-------
53a6ff88f7 [Routing] Fixed XML options resolution
This PR was merged into the 3.4 branch.
Discussion
----------
[Routing] removed a useless var
| 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 | ~
This was never documented, we should rely on `$routes->import()` instead.
Commits
-------
10c1313d41 [Routing] removed a useless var
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Add the missing translations for the Swedish ("sv") locale
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30190
| License | MIT
| Doc PR | -
Added the missing translations to the `src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf` file.
Commits
-------
7e9f63da43 [Validator] Add missing translations for Swedish locale
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] replace "nullable" env processor by improving the "default" one
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Neither `nullable` nor `default` are released yet.
I propose to replace the `nullable` processor (see #29767) with an improved `default` one (from #28976).
`%env(default::FOO)%` now defaults to `null` when the env var doesn't exist or compares to false".
ping @jderusse @bpolaszek
Commits
-------
c50aad2be1 [DI] replace "nullable" env processor by improving the "default" one
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] add ResponseInterface::toArray()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
I'd like we discuss adding a `toArray()` method to `ResponseInterface`.
JSON responses are so common when doing server-side requests that this may help remove boilerplate - especially the logic dealing with errors.
WDYT?
(about flags, I don't think we should make them configurable: if one really needs to deal with custom flags, there's always `ResponseInterface::getContent()` - but it should be very rare.).
Commits
-------
aabd1d455e [HttpClient] add ResponseInterface::toArray()
* 4.2: (27 commits)
cs fix
cs fix
[PHPUnit-Bridge] override some environment variables
[TwigBridge] Remove use spaceless tag
Upgrade zookeeper ext
[translation] Update defaut format from yml to yaml
Change default log level for output streams
update docblock to match the actual behavior
Don't resolve the Deprecation error handler mode until a deprecation is triggered
compatibility with phpunit8
Make 'headers' key optional for encoded messages
[Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods
Fix undefined variable fromConstructor when passing context to getTypes
Added translations for chineese language.
Allow 3rd argument to be null
Remove whitespace (tab on blank line)
[Monolog] Really reset logger when calling logger::reset()
[Form] Fixes debug:form appears many times as type extensions configured with new getExtendedTypes method
Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
...
* 3.4:
cs fix
cs fix
[PHPUnit-Bridge] override some environment variables
[TwigBridge] Remove use spaceless tag
[translation] Update defaut format from yml to yaml
Change default log level for output streams
update docblock to match the actual behavior
compatibility with phpunit8
[Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods
Added translations for chineese language.
This PR was merged into the 3.4 branch.
Discussion
----------
[TwigBridge] Remove usages of the spaceless tag
| 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 spaceless tag is deprecated since version 2.7.
Commits
-------
2ee178b5c5 [TwigBridge] Remove use spaceless tag
This PR was merged into the 4.2 branch.
Discussion
----------
[Messenger] Make 'headers' key optional for encoded messages
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30455
| License | MIT
Commits
-------
bb881c9cd0 Make 'headers' key optional for encoded messages
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Translation] Add XLIFF 1 source to metadata to differentiate from attr
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Here's our use case this patch solves:
We have 2 translation files. One is created by developer and has empty `<target>`. Second one is created by translator and has non-empty `<target>`, but same `<source>`.
Now, unlike Symfony fixtures, we also use `resname=` XLIFF1 attribute. This allows us to detect when translation is out of date, which happens when `<source>` in dev translation is changed, but `resname=` is not. As visualization which better illustrates problem:
dev.xlf:
```xml
<trans-unit id="source_is_different" resname="source_is_different">
<source>Welcome to Calida</source>
</trans-unit>
```
real.xlf:
```xml
<trans-unit id="source_is_different" resname="source_is_different">
<source>Welcome to Jacqueline</source>
<target>Willkommen bei Jacqueline</target>
</trans-unit>
```
We need to be able to tell `<source>` for this pair is different (so we prepend alert glyph to translation message, to alert developer something is wrong). In current XliffFileLoader there is no way for consumer to figure out if translation key came from `resname` or `<source>`, so we had to copy whole loader.
Commits
-------
ab04f25da4 [Translation] Add XLIFF 1 source to metadata to differentiate from attr
This PR was merged into the 3.4 branch.
Discussion
----------
compatibility with phpunit8
This basically adds the same phpunit8 compatibility layer added in https://github.com/symfony/symfony/pull/30084 (but for other test classes)
See also discussion in https://github.com/symfony/symfony/issues/30071
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30071
| License | MIT
| Doc PR | none
Commits
-------
5ef254fa65 compatibility with phpunit8
This PR was squashed before being merged into the 3.4 branch (closes#30498).
Discussion
----------
[translation] Update defaut format from yml to yaml
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #30443
| License | MIT
| Doc PR |
As stated in #30443 , command `php bin/console translation:update --dump-messages --force fr` will by default output the translation to yml format, which is not supported by Symfony
Commits
-------
ba42030641 [translation] Update defaut format from yml to yaml
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] fixes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Spotted while playing with the client.
There is an issue with 307/308 redirects + streamed body that is not fixed here; use string bodies for now.
I'm going to look for a solution in another PR.
Commits
-------
3eca2b448d [HttpClient] fixes
This PR was squashed before being merged into the 4.3-dev branch (closes#30482).
Discussion
----------
[Mime] Fix support for date form parts
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| 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? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
Commits
-------
5c8a4e3deb [Mime] removed the 2 parts constraints on Multipart (not true for DataFormPart for instance)
0450c4f244 [Mime] fixed support for date form parts
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Mime] Use "yield from" when possible
| 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 | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
df1b627417 [Mime] used yield-from when possible
This PR was squashed before being merged into the 4.3-dev branch (closes#30385).
Discussion
----------
[SecurityBundle] Validate the IPs configured in access_control
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30299
| License | MIT
| Doc PR | -
Commits
-------
857ac9519e [SecurityBundle] Validate the IPs configured in access_control
This PR was squashed before being merged into the 4.3-dev branch (closes#30413).
Discussion
----------
[HttpClient][Contracts] introduce component and related contracts
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28628
| License | MIT
| Doc PR | -
This PR introduces new `HttpClient` contracts and
component. It makes no compromises between DX, performance, and design.
Its surface should be very simple to use, while still flexible enough
to cover most advanced use cases thanks to streaming+laziness.
Common existing HTTP clients for PHP rely on PSR-7, which is complex
and orthogonal to the way Symfony is designed. More reasons we need
this in core are the [package principles](https://en.wikipedia.org/wiki/Package_principles): if we want to be able to keep our
BC+deprecation promises, we have to build on more stable and more
abstract dependencies than Symfony itself. And we need an HTTP client
for e.g. Symfony Mailer or #27738.
The existing state-of-the-art puts a quite high bar in terms of features we must
support if we want any adoption. The code in this PR aims at implementing an
even better HTTP client for PHP than existing ones, with more (useful) features
and a better architecture. What a pitch :)
Two full implementations are provided:
- `NativeHttpClient` is based on the native "http" stream wrapper.
It's the most portable one but relies on a blocking `fopen()`.
- `CurlHttpClient` relies on the curl extension. It supports full
concurrency and HTTP/2, including server push.
Here are some examples that work with both clients.
For simple cases, all the methods on responses are synchronous:
```php
$client = new NativeHttpClient();
$response = $client->get('https://google.com');
$statusCode = $response->getStatusCode();
$headers = $response->getHeaders();
$content = $response->getContent();
```
By default, clients follow redirects. On `3xx`, `4xx` or `5xx`, the `getHeaders()` and `getContent()` methods throw an exception, unless their `$throw` argument is set to `false`.
This is part of the "failsafe" design of the component. Another example of this
failsafe property is that broken dechunk or gzip streams always trigger an exception,
unlike most other HTTP clients who can silently ignore the situations.
An array of options allows adjusting the behavior when sending requests.
They are documented in `HttpClientInterface`.
When several responses are 1) first requested in batch, 2) then accessed
via any of their public methods, requests are done concurrently while
waiting for one.
For more advanced use cases, when streaming is needed:
Streaming the request body is possible via the "body" request option.
Streaming the response content is done via client's `stream()` method:
```php
$client = new CurlHttpClient();
$response = $client->request('GET', 'http://...');
$output = fopen('output.file', 'w');
foreach ($client->stream($response) as $chunk) {
fwrite($output, $chunk->getContent());
}
```
The `stream()` method also works with multiple responses:
```php
$client = new CurlHttpClient();
$pool = [];
for ($i = 0; $i < 379; ++$i) {
$uri = "https://http2.akamai.com/demo/tile-$i.png";
$pool[] = $client->get($uri);
}
$chunks = $client->stream($pool);
foreach ($chunks as $response => $chunk) {
// $chunk is a ChunkInterface object
if ($chunk->isLast()) {
$content = $response->getContent();
}
}
```
The `stream()` method accepts a second `$timeout` argument: responses that
are *inactive* for longer than the timeout will emit an empty chunk to signal
it. Providing `0` as timeout allows monitoring responses in a non-blocking way.
Implemented:
- flexible contracts for HTTP clients
- `fopen()` + `curl`-based clients with close feature parity
- gzip compression enabled when possible
- streaming multiple responses concurrently
- `base_uri` option for scoped clients
- progress callback with detailed info and able to cancel the request
- more flexible options for precise behavior control
- flexible timeout management allowing e.g. server sent events
- public key pinning
- auto proxy configuration via env vars
- transparent IDN support
- `HttpClient::create()` factory
- extensive error handling, e.g. on broken dechunk/gzip streams
- time stats, primary_ip and other info inspired from `curl_getinfo()`
- transparent HTTP/2-push support with authority validation
- `Psr18Client` for integration with libs relying on PSR-18
- free from memory leaks by avoiding circular references
- fixed handling of redirects when using the `fopen`-based client
- DNS cache pre-population with `resolve` option
Help wanted (can be done after merge):
- `FrameworkBundle` integration: autowireable alias + semantic configuration for default options
- add `TraceableHttpClient` and integrate with the profiler
- logger integration
- add a mock client
More ideas:
- record/replay like CsaGuzzleBundle
- use raw sockets instead of the HTTP stream wrapper
- `cookie_jar` option
- HTTP/HSTS cache
- using the symfony CLI binary to test ssl-related options, HTTP/2-push, etc.
- add "auto" mode to the "buffer" option, based on the content-type? or array of content-types to buffer
- *etc.*
Commits
-------
fc83120691 [HttpClient] Add Psr18Client - aka a PSR-18 adapter
8610668c1c [HttpClient] introduce the component
d2d63a28e1 [Contracts] introduce HttpClient contracts
This PR was squashed before being merged into the 4.3-dev branch (closes#30377).
Discussion
----------
[Validator] add MIR card scheme
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30376
| License | MIT
Commits
-------
aecb33a620 [Validator] add MIR card scheme
This PR was merged into the 4.2 branch.
Discussion
----------
[Form] Avoid a form type extension appears many times in debug:form
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30394 <!-- #-prefixed issue number(s), if any -->
| License | MIT
This PR fixes#30394. Avoid a form type extension appears many times in debug:form command. This is caused by new 4.2 feature getExtendedTypes().
Commits
-------
c4be39ce21 [Form] Fixes debug:form appears many times as type extensions configured with new getExtendedTypes method
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Form] Allow to disable and customize PercentType symbol
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| 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 | #28796 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#11078
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
## `PercentType` `symbol` option
As of this writing, Symfony will forcibly append a percentage sign (`%`) to all input fields that are of the PercentType form type. This PR will introduce a boolean flag called `symbol` that, when `false`, will not display the percentage sign. Each of the default layouts that define percent_widget will respect this option. You could also use a customised string as value for `symbol` option.
By default, this new option will be set to `true` so that it maintains backward compatibility. The unit tests have been updated where appropriate, and a new unit test has been added (as appropriate).
Commits
-------
53c5f41f37 [Form] Allow to disable and customize PercentType symbol
9aeaea06fc Add ‘symbol’ option to PercentType
This PR was merged into the 4.2 branch.
Discussion
----------
[PropertyInfo] Fix undefined variable fromConstructor when passing context to getTypes
| Q | A
| ------------- | ---
| Branch? | 4.1, 4.2, master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | symfony/symfony-docs#10969
| License | MIT
| Doc PR |
If passing context to getTypes, it checks value of $context['enable_constructor_extraction'] for true/false or the constructor value of enableConstructorExtraction and should then populate fromConstructor if necessary. The missing brackets around the first part of this check mean that fromConstructor is only applied if context is not set.
This fixes the issue described at [symfony/symfony-docs#10969](https://github.com/symfony/symfony-docs/pull/10969)
Commits
-------
8e401afa37 Allow 3rd argument to be null
04dc6921bd Remove whitespace (tab on blank line)
a0aa15a41e Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
c2986d5e40 Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
42995c859c Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
2d88298ace Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php
e43a3bce11 Update ReflectionExtractorTest.php
2c91c754bc Update ReflectionExtractorTest.php
5acc85c48b Update ReflectionExtractorTest.php
d0a2dc0a2d Update ReflectionExtractorTest.php
be8d14a129 Fix undefined variable fromConstructor when passing context to getTypes
This PR was squashed before being merged into the 4.3-dev branch (closes#30325).
Discussion
----------
[HttpKernel] Prevent search engines from indexing dev applications
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30318
| License | MIT
| Doc PR | TODO
Add the *X-Robots-Tag: noindex* to dev (and test) applications to prevent search engines to index them.
Commits
-------
3dd86719bf [HttpKernel] Prevent search engines from indexing dev applications
This PR was squashed before being merged into the 4.3-dev branch (closes#30445).
Discussion
----------
[Mime] Fix generate message id with named address
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | yes
| 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 |
When using a NamedAddress in from(), the generated MessageId don't pass the validation.
In effect, the email passed to generateMessageId look like this `Fabien <fabien@symfony.com>` and the strstr transform email in this `4641b2b294b53fe983a05b1a@symfony.com>`
By passing the address only instead of toString, it's fixed.
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
Commits
-------
375ac9237f [Mime] Fix generate message id with named address
This PR was squashed before being merged into the 4.3-dev branch (closes#30390).
Discussion
----------
[FrameworkBundle] Fix UrlGenerator::generate to return an empty string instead of null
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30306
| License | MIT
Fix#30306 : Controller::generateUrl() must be of the type string, null returned
Commits
-------
c5b1247977 [FrameworkBundle] Fix UrlGenerator::generate to return an empty string instead of null
This PR was merged into the 3.4 branch.
Discussion
----------
[Debug] detect annotations before blank docblock lines
| 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 |
This fixes the tests and a small issue after the CS changes made in df1d50dcc2 for #29920.
Commits
-------
dedd526b19 detect annotations before blank docblock lines
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] Added transport agnostic exception
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30346
| License | MIT
| Doc PR | TODO
As described in #30346, client code shouldn't care about which transport is currently used by the message bus. This pr adds a new generic exception that is thrown by the `AmqpSender` if the message couldn't be delivered.
Commits
-------
7d6a3fa487 Updated changelog to document changes in AmqpReceiver
62a08eeea0 Updated exception message in AmqpSender, updated AmqpReceiver to throw new TransportException
b2b0640d80 Chain new exception with previous one
06c84040c4 forgot one backslash, my bad
93c10013fa [Messenger] Added new TransportException which is thrown if transport could not send a message
This PR was squashed before being merged into the 4.3-dev branch (closes#29254).
Discussion
----------
[FrameworkBundle] Added the condition routing option to the debug router command
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| 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 | <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
This PR will add the condition routing option to debug:router command, to show if a route have conditions or not and showing this conditions.
Commits
-------
92bdc9b5f4 [FrameworkBundle] Added the condition routing option to the debug router command
* 4.2:
fixed CS
Autoconfig: don't automatically tag decorators
removed suggestion
[PropertyAccess] Fixed PropertyPathBuilder remove that fails to reset internal indexes
bumped Symfony version to 4.2.5
updated VERSION for 4.2.4
updated CHANGELOG for 4.2.4
bumped Symfony version to 3.4.24
updated VERSION for 3.4.23
update CONTRIBUTORS for 3.4.23
updated CHANGELOG for 3.4.23
[Routing][ServiceRouterLoader] Remove an outdated comment
* 3.4:
fixed CS
removed suggestion
[PropertyAccess] Fixed PropertyPathBuilder remove that fails to reset internal indexes
bumped Symfony version to 3.4.24
updated VERSION for 3.4.23
update CONTRIBUTORS for 3.4.23
updated CHANGELOG for 3.4.23
[Routing][ServiceRouterLoader] Remove an outdated comment
This PR was merged into the 3.4 branch.
Discussion
----------
[Routing][ServiceRouterLoader] Remove an outdated comment
| 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 | -
Since 0043653ea8, this comment is technically false.
Commits
-------
a2b73489dd [Routing][ServiceRouterLoader] Remove an outdated comment
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle][Routing] allow boolean container parameters for routes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30366
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/11059
This fixes https://github.com/symfony/symfony/issues/30366 and adds support for boolean container parameters in route conditions, defaults etc.
Commits
-------
21f4e38800 [FrameworkBundle][Routing] allow boolean container parameters for routes
This PR was squashed before being merged into the 4.3-dev branch (closes#29661).
Discussion
----------
[Filesystem] Support resources and deprecate using arrays in dumpFile() and appendToFile()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Running PHPStan on my project picked up that passing a resource to `Filesystem::dumpFile()` didn't match the documented type.
I found this has been discussed in #20980 and #28019, without a clear result. But, my reading is that only strings should be supported. While I think that not supporting streams makes this a lot less useful (and I'm going to switch away from it), this does need to be resolved. So, I've deprecated using arrays and resources.
Commits
-------
0eaf9d2474 [Filesystem] Support resources and deprecate using arrays in dumpFile() and appendToFile()
* 4.2:
Removed non-existing parameters for LogoutUrlGenerator calls
[WebProfilerBundle] toolbar: invisible route name in Firefox
Drop spurious execution bit
[HttpKernel] Correctly merging cache directives in HttpCache/ResponseCacheStrategy
[Validator] Add the missing translations for the Latvian ("lv") locale
Fixed the DebugClassLoader compatibility with eval()'d code on Darwin
[Validator] Update Serbian translation file
* 3.4:
Removed non-existing parameters for LogoutUrlGenerator calls
[HttpKernel] Correctly merging cache directives in HttpCache/ResponseCacheStrategy
[Validator] Add the missing translations for the Latvian ("lv") locale
Fixed the DebugClassLoader compatibility with eval()'d code on Darwin
[Validator] Update Serbian translation file
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Form] be able to specify the input format for times
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This expands the work started in #29887 to also allow to configure the input format for string inputs in the `TimeType`.
Commits
-------
2d9bc18c1b be able to specify the input format for times
This PR was squashed before being merged into the 4.2 branch (closes#30383).
Discussion
----------
[WebProfilerBundle] toolbar: invisible route name in Firefox
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #29858
| License | MIT
| Doc PR | -
This fixes#29858, fixing a bug that prevents Route name displaying in debug toolbar on Firefox
Commits
-------
6b6bd453e1 [WebProfilerBundle] toolbar: invisible route name in Firefox
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Security] deprecate the Role and SwitchUserRole classes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #20824
| License | MIT
| Doc PR | symfony/symfony-docs#11047
In #20801, we deprecated the `RoleInterface`. The next logical step would be to also deprecate the `Role` class. However, we currently have the `SwitchUserRole` class (a sub-class of `Role`) that acts as an indicator to check whether or not the authenticated user switched to another user.
This PR proposes an alternative solution to the usage of the special `SwitchUserRole` class by storing the original token inside the `UsernamePasswordToken`. This PR is not complete, but rather acts as a proof of concept of how we could get rid of the `Role` and the `SwitchUserRole` classes.
Please share your opinions whether you think this is a valid approach and I will be happy to finalise the PR.
Commits
-------
d7aaa615b9 deprecate the Role and SwitchUserRole classes
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Add the missing translations for the Latvian ("lv") locale #30174Fixes#30174
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30174
| License | MIT
| Doc PR | -
Commits
-------
86b8c253c7 [Validator] Add the missing translations for the Latvian ("lv") locale
This PR was squashed before being merged into the 3.4 branch (closes#26532).
Discussion
----------
[HttpKernel] Correctly merging cache directives in HttpCache/ResponseCacheStrategy
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26245, #26352, #28872
| License | MIT
| Doc PR | -
This PR is a first draft to fix the incorrect merging of private and other cache-related headers that are not meant for the shared cache but the browser (see mentioned issues).
The existing implementation of `HttpFoundation\Response` is very much tailored to the `HttpCache`, for example `isCacheable` returns `false` if the response is `private`, which is not true for a browser cache. That is why my implementation does not longer use much of the response methods. They are however still used by the `HttpCache` and we should keep them as-is. FYI, the `ResponseCacheStrategy` does **not** affect the stored data of `HttpCache` but is only applied to the result of multiple merged subrequests/ESI responses.
I did read up a lot on RFC2616 as a reference. [Section 13.4](https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4) gives an overall view of when a response MAY be cached. [Section 14.9.1](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1) has more insight into the `Cache-Control` directives.
Here's a summary of the relevant information I applied to the implementation:
- > Unless specifically constrained by a cache-control (section 14.9) directive, a caching system MAY always store a successful response (see section 13.8) as a cache entry, MAY return it without validation if it is fresh, and MAY return it after successful validation.
A response without cache control headers is totally fine, and it's up to the cache (shared or private) to decide what to do with it. That is why the implementation does not longer set `no-cache` if no `Cache-Control` headers are present.
- > A response received with a status code of 200, 203, 206, 300, 301 or 410 MAY be stored […] unless a cache-control directive prohibits caching.
> A response received with any other status code (e.g. status codes 302 and 307) MUST NOT be returned […] unless there are cache-control directives or another header(s) that explicitly allow it.
This is what `ResponseCacheStrategy::isUncacheable` implements to decide whether a response is not cacheable at all. It differs from `Response::isCacheable` which only returns true if there are actual `Cache-Control` headers.
- > [Section 13.2.3](https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.3): When a response is generated from a cache entry, the cache MUST include a single Age header field in the response with a value equal to the cache entry's current_age.
That's why the implementation **always** adds the `Age` header. It takes the oldest age of any of the responses as common denominator for the content.
- > [Section 14.9.3](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3): If a response includes an s-maxage directive, then for a shared cache (but not for a private cache), the maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header.
This effectively means that `max-age`, `s-maxage` and `Expires` must all be kept on the response. My implementation assumes that we can only do that if they exist in **all** of the responses, and then takes the lowest value of any of them. Be aware the implementation might look confusing at first. Due to the fact that the `Age` header might come from another subresponse than the lowest expiration value, the values are stored relative to the current response date and then re-calculated based on the age header.
The Symfony implementation did not and still does not implement the full RFC. As an example, some of the `Cache-Control` headers (like `private` and `no-cache`) MAY actually have a string value, but the implementation only supports boolean. Also, [Custom `Cache-Control` headers](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.6) are currently not merged into the final response.
**ToDo/Questions:**
1. [Section 13.5.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.2) specifies that we must add a [`Warning 214 Transformation applied`](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46) if we modify the response headers.
2. Should we add an `Expires` headers based on `max-age` if none is explicitly set in the responses? This would essentially provide the same information as `max-age` but with support for HTTP/1.0 proxies/clients.
3. I'm not sure about the implemented handling of the `private` directive. The directive is currently only added to the final response if it is present in all of the subresponses. This can effectively result in no cache-control directive, which does not tell a shared cache that the response must not be cached. However, adding a `private` might also tell a browser to actually cache it, even though non of the other responses asked for that.
4. > [Section 14.9.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.2): The purpose of the `no-store` directive is to prevent the inadvertent release or retention of sensitive information […]. The `no-store` directive applies to the entire message, and MAY be sent either in a response or in a request. If sent in a request, a cache MUST NOT store any part of either this request or any response to it. If sent in a response, a cache MUST NOT store any part of either this response or the request that elicited it.
I have not (yet) validated whether the `HttpCache` implementation respects any of this.
5. As far as I understand, the current implementation of [`ResponseHeaderBag::computeCacheControlValue`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php#L313) is incorrect. `no-cache` means a response [must not be cached by a shared or private cache](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1), which overrides `private` automatically.
5. The unit tests are still very limited and I want to add plenty more to test and sort-of describe the implementation or assumptions on the RFC.
/cc @nicolas-grekas
#SymfonyConHackday2018
Commits
-------
893118f978 [HttpKernel] Correctly merging cache directives in HttpCache/ResponseCacheStrategy
If passing context to getTypes, it checks value of $context['enable_constructor_extraction'] for true/false or the constructor value of enableConstructorExtraction and should then populate fromConstructor if necessary. The missing brackets around the first part of this check mean that fromConstructor is only applied if context is not set.
This fixes the issuse described at [symfony/symfony-docs#10969](https://github.com/symfony/symfony-docs/pull/10969)
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Update Serbian translation file
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| 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 | #30189 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | / <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- 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.
-->
I am not sure about some translations, if someone could check these, I would appreciate it.
Also, I've found that singular/plural translations have 3 translations. I am not sure if that's a mistake or not. I removed the third translation, but if I was wrong, I'll be happy to put it back.
Commits
-------
9e9a57a544 [Validator] Update Serbian translation file
* 4.2: (26 commits)
Apply php-cs-fixer rule for array_key_exists()
[Cache] fix warming up cache.system and apcu
[Security] Change FormAuthenticator if condition
handles multi-byte characters in autocomplete
speed up tests running them without debug flag
[Translations] added missing Croatian validators
Fix getItems() performance issue with RedisCluster (php-redis)
[VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
IntegerType: reject submitted non-integer numbers
be keen to newcomers
[HttpKernel] Fix possible infinite loop of exceptions
fixed CS
[Validator] Added missing translations for Afrikaans
do not validate non-submitted form fields in PATCH requests
Update usage example in ArrayInput doc block.
[Console] Prevent ArgvInput::getFirstArgument() from returning an option value
[Validator] Fixed duplicate UUID
fixed CS
[EventDispatcher] Fix unknown priority
Avoid mutating the Finder when building the iterator
...
* 3.4: (24 commits)
Apply php-cs-fixer rule for array_key_exists()
[Security] Change FormAuthenticator if condition
handles multi-byte characters in autocomplete
speed up tests running them without debug flag
[Translations] added missing Croatian validators
Fix getItems() performance issue with RedisCluster (php-redis)
[VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
IntegerType: reject submitted non-integer numbers
be keen to newcomers
[HttpKernel] Fix possible infinite loop of exceptions
fixed CS
[Validator] Added missing translations for Afrikaans
do not validate non-submitted form fields in PATCH requests
Update usage example in ArrayInput doc block.
[Console] Prevent ArgvInput::getFirstArgument() from returning an option value
[Validator] Fixed duplicate UUID
fixed CS
[EventDispatcher] Fix unknown priority
Avoid mutating the Finder when building the iterator
[Validator] Add the missing translations for the Greek (el) locale
...
This PR was squashed before being merged into the 3.4 branch (closes#30347).
Discussion
----------
[Security] Change FormAuthenticator if condition
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30341
| License | MIT
| Doc PR | -
I changed the if condition in `SimpleFormAuthenticationListener` and `UsernamePasswordFormAuthenticationListener` based on the solution provided by @nikic in issue #30341
#OpenSourceFriday
Commits
-------
67ae121b2e [Security] Change FormAuthenticator if condition
This PR was merged into the 3.4 branch.
Discussion
----------
[Console] handles multi-byte characters in autocomplete
fixes#29966
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| Bug fix? | yes
| 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 | #29966 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | - <!-- required for new features -->
I used the `mb_ord` to detect whether the amount of bytes read is valid before proceeding. I limit the number of bytes read to 4 before giving up because characters can use at most 4 bytes.
The test passes with or without the fix though.
Commits
-------
47320a63e2 handles multi-byte characters in autocomplete
This PR was merged into the 3.4 branch.
Discussion
----------
Fix getItems() performance issue with RedisCluster (php-redis)
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | TBD
| License | MIT
On any kind of multi loads, including tags loading where it's always the case, current code leads to an explosion of Redis lookups affecting performance on RedisCluster _(as it does not support pipeline)_.
This backports the code for mget() usage from 4.x in order to fix it.
It's done with one small improvment which would also be relevant for 4.x, only using pipeline on cluster on predis as mget is more efficient (ref redis doc).
Commits
-------
178506e72c Fix getItems() performance issue with RedisCluster (php-redis)
This PR was merged into the 3.4 branch.
Discussion
----------
[VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
| 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 | -
Fixes the root issue that led to https://github.com/symfony/symfony/pull/30311#issuecomment-466457434
Commits
-------
29a0683107 [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Monolog] Added a way to configure the ConsoleFormatter from the ConsoleHandler
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR |
see also https://github.com/symfony/monolog-bundle/pull/297
from that:
![image](https://user-images.githubusercontent.com/408368/53246085-f63ed380-36af-11e9-9bff-2e42f8af141c.png)
to that:
![image](https://user-images.githubusercontent.com/408368/53246115-0787e000-36b0-11e9-93ef-e47ed058adbf.png)
with some configuration:
```yaml
diff --git a/config/packages/dev/monolog.yaml b/config/packages/dev/monolog.yaml
index b1998da..66ae2db 100644
--- a/config/packages/dev/monolog.yaml
+++ b/config/packages/dev/monolog.yaml
@@ -17,3 +17,6 @@ monolog:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
+ console_formater_options:
+ format: "%%datetime%% %%start_tag%%%%level_name%%%%end_tag%% <comment>[%%channel%%]</> %%message%%%%context%%\n"
+ multiline: false
```
Commits
-------
5e494db04c [Monolog] Added a way to configure the ConsoleFormatter from the ConsoleHandler
This PR was merged into the 3.4 branch.
Discussion
----------
[FrameworkBundle][SecurityBundle] speed up tests running them without debug flag
| 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
-------
dfb924f6a9 speed up tests running them without debug flag
This PR was merged into the 4.3-dev branch.
Discussion
----------
[TwigBridge] rename parent_form() to form_parent()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | symfony/symfony-docs#11049
We got some feedback on the blog post that form_parent() would be better
for consistency with all the existing form_*() functions. I think that
user has a point about that.
Commits
-------
057d177378 rename parent_form() to form_parent()