This PR was merged into the 4.2-dev branch.
Discussion
----------
Don't "replace" symfony/contracts
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Maintaining an exact version number here is going to be painful on the long run.
Let's free us from this burden.
Commits
-------
7b4e5cc50b Don't "replace" symfony/contracts
This PR was merged into the 2.8 branch.
Discussion
----------
[HttpFoundation] Fix unprepared BinaryFileResponse sends empty file
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes, with the exception of preexisting, unrelated failures
| Fixed tickets | #28237
| License | MIT
| Doc PR |
When you call `BinaryFileResponse#sendContent()` without first calling `prepare()` the response is sent but the contents are empty. `prepare()` properly initializes the `$maxlen` and `$offset` properties. However, `sendContent()` doesn't do any sanity checking, and so, uses the uninitialized properties. This causes `stream_copy_to_stream()` to copy empty contents and the file that is sent, to contain nothing.
This change initializes the properties at definition instead of in `prepare()`.
> Additionally:
> - Bug fixes must be submitted against the lowest branch where they apply
~I'm not sure how early this bug exists, or how far back to go. I'll check to see if 2.7 and 2.8 are affected and report back.~
Commits
-------
dba8687a5d Instantiate $offset and $maxlen at definition
This PR was merged into the 4.1 branch.
Discussion
----------
[Cache] minor code update to leverage PHP 7.1
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
c1bf1918ec [Cache] minor code update to leverage PHP 7.1
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Serializer] Update changelog about the new $encoderIgnoredNodeTypes arg in XmlEncoder contrustor
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/27926
| License | MIT
| Doc PR | /
Commits
-------
49f3bfc823 Update changelog
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] Don't make EnvelopeItemInterface extend Serializable
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes (on experimental API)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
`Serializable` is a broken interface, see e.g. https://externals.io/message/98834
I don't think we should force ppl to implement it anywhere.
Actually, it isn't required to be able to serialize an object, and it doesn't enforce making a class serializable (as the `serialize()` method can throw).
What was the purpose of the removed logic? ping @sroze @ogizanagi
Commits
-------
2beda894f2 [Messenger] Don't make EnvelopeItemInterface extend Serializable
This PR was merged into the 3.4 branch.
Discussion
----------
[PhpUnitBridge] keep compat with composer 1.0
| 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 | -
Remove `--no-suggest` when installing PHPUnit from the bridge to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS.
Commits
-------
28492a7bb1 [PhpUnitBridge] keep compat with composer 1.0
This PR was squashed before being merged into the 4.1 branch (closes#28251).
Discussion
----------
[HttpFoundation] Allow RedisCluster class for RedisSessionHandler
| Q | A
| ------------- | ---
| Branch? | 4.1 <!-- 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 | <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR |
The `RedisSessionHandler` added in Symfony 4.1 was supposed to accept `RedisCluster` instances but that possibility was not in the condition, leading to an `InvalidArgumentException`.
I formatted the object type condition to allow the `RedisCluster` instance value and also added a test for it.
A double space formatting issue has been fixed too (which is included in the same commit, I can change that if needed).
I could not add a test using RedisCluster, as the installed Redis instance on Travis doesn't use clusters.
Commits
-------
d2ecea0b6e [HttpFoundation] Allow RedisCluster class for RedisSessionHandler
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Serializer] XmlEncoder doesn't ignore PI nodes while encoding
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | /
| License | MIT
| Doc PR | /
It's sometimes important to get only the XML body without the processing instructions (like the `<?xml version="1.0" ?>` on the top of your XML doc). At the moment, it's possible to ignore them while decoding, but not while encoding.
```php
$encoder = new XmlEncoder('response', null, $ignoredNodeTypes = [XML_PI_NODE]);
echo $encoder->encode([], 'xml');
```
```
Expected:
<response/>
Actual:
<?xml version="1.0"?>
<response/>
```
So, a new `$encoderIgnoredNodeTypes` arg is added to the constructor which will be:
```php
public function __construct(string $rootNodeName = 'response', int $loadOptions = null, array $decoderIgnoredNodeTypes = array(XML_PI_NODE, XML_COMMENT_NODE), array $encoderIgnoredNodeTypes = array())
```
Commits
-------
2223fcc5b9 Allow to ignore PI while encoding
This PR was merged into the 4.2-dev branch.
Discussion
----------
Mock date() in ClockMock
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no (In case `date()` is mocked in some other way execution would fail because of redeclaration. Could be avoided with an extra `function_exists()` check. WDYT?)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
As to the [PHP documentation](https://secure.php.net/manual/en/function.date.php) `date()` uses the value of `time()` as timestamp if none is given. `date()` has to be mocked in ClockMock as well for this still being true, otherwise `\time()` is used as default.
BTW: The msec part of `microtime()` has 8 fractional digits on my system, ClockMock returns only 6...
Commits
-------
e8ba79adb9 [Bridge/PhpUnit] Mock date() in ClockMock
* 4.1:
[DoctrineBridge] support __toString as documented for UniqueEntityValidator
[travis] enable Redis cluster
[Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
fix data mapper return type in docblock
fix type error handling when writing values
* 3.4:
[DoctrineBridge] support __toString as documented for UniqueEntityValidator
[travis] enable Redis cluster
[Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
fix data mapper return type in docblock
fix type error handling when writing values
This PR was squashed before being merged into the 4.2-dev branch (closes#28221).
Discussion
----------
[DomCrawler] Add a way to filter direct children
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28171
| License | MIT
| Doc PR | -
The Dom-Crawler component only has a `filter()` method (to filter the node and all its children) and a `children()` method to return direct children.
**There is currently no way to easily filter (thanks to a selector) the direct children of a node, like jQuery allows so (with a selector passed to the `.children([selector])` method).**
**This PR adds a way to optionally filter direct children thanks to a CSS selector**. Here is an example of the usage:
```php
$html = <<<'HTML'
<html>
<body>
<div id="foo">
<p class="lorem" id="p1"></p>
<p class="lorem" id="p2"></p>
<div id="nested">
<p class="lorem" id="p3"></p>
</div>
</div>
</body>
</html>
HTML;
$crawler = new Crawler($html);
$foo = $crawler->filter('#foo');
$foo->children() // will select `#p1`, `#p2` and `#nested`
$foo->children('p') // will select `#p1` and `p2`
$foo->children('.lorem') // will select `#p1` and `p2`
```
This PR adds only an optional parameter and adds no BC break.
Commits
-------
f634afdb6f [DomCrawler] Add a way to filter direct children
This PR was merged into the 4.2-dev branch.
Discussion
----------
[DI] Allow autowiring by type + parameter name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/issues/10206
In #27165, we introduced the possibility to bind by type+name:
```yaml
bind:
Psr\Log\LoggerInterface $myLogger: @monolog.logger.my_logger
```
But we forgot about aliases. For consistency, they could and should allow doing the same. More importantly, this will open up interesting use cases where bundles could provide default values for typed+named arguments (using the new `ContainerBuilder::registerAliasForArgument()` method). E.g:
```yaml
services:
Psr\Cache\CacheItemPoolInterface $appCacheForecast: @app.cache.forecast
```
Works also for controller actions and service subscribers (using the real service id as the key).
Commits
-------
c0b8f53bcb [DI] Allow autowiring by type + parameter name
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28248
| License | MIT
| Doc PR | -
As described in https://github.com/php-memcached-dev/php-memcached/issues/24 and because we enable the binary protocol by default.
Commits
-------
8b59d177db [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
This PR was squashed before being merged into the 3.4 branch (closes#28252).
Discussion
----------
[DoctrineBridge] support __toString as documented for UniqueEntityValidator
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28245
| License | MIT
| Doc PR | -
This fixes https://github.com/symfony/symfony/issues/28245.
It brings back handling `__toString` as documented for invalid values.
Commits
-------
2ac883a99b [DoctrineBridge] support __toString as documented for UniqueEntityValidator