Commit Graph

38166 Commits

Author SHA1 Message Date
Nicolas Grekas
c1bf1918ec [Cache] minor code update to leverage PHP 7.1 2018-08-27 11:36:56 +02:00
Martynas Sudintas
4224145a69 [Serializer] AbstractObjectNormalizer improve perf when checking types 2018-08-26 19:46:07 +03:00
Nicolas Grekas
ff1727e2ee Merge branch '4.1'
* 4.1:
  [HttpFoundation] cleanup test case
  [HttpFoundation] Allow RedisCluster class for RedisSessionHandler
2018-08-26 10:35:20 +02:00
Nicolas Grekas
620dfdec13 [HttpFoundation] cleanup test case 2018-08-26 10:29:34 +02:00
Nicolas Grekas
aa8b9c0ecc bug #28251 [HttpFoundation] Allow RedisCluster class for RedisSessionHandler (michaelperrin)
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
2018-08-26 10:23:36 +02:00
Michaël Perrin
d2ecea0b6e [HttpFoundation] Allow RedisCluster class for RedisSessionHandler 2018-08-26 10:23:26 +02:00
Nicolas Grekas
466d1ab328 [VarDumper] make RedisCaster handle RedisCluster and dump all options on all drivers 2018-08-25 23:22:10 +02:00
Kévin Dunglas
9ef362eecb
feature #27926 [Serializer] XmlEncoder doesn't ignore PI nodes while encoding (maidmaid)
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
2018-08-25 12:11:08 +02:00
Dany Maillard
2223fcc5b9 Allow to ignore PI while encoding 2018-08-24 19:15:24 +02:00
Nicolas Grekas
4e4b21668a Merge branch '4.1'
* 4.1:
  [HttpKernel] fix forwarding trusted headers as server parameters
2018-08-24 16:41:28 +02:00
Nicolas Grekas
3ac90c172a Merge branch '3.4' into 4.1
* 3.4:
  [HttpKernel] fix forwarding trusted headers as server parameters
2018-08-24 16:41:24 +02:00
Nicolas Grekas
96e0833b93 Merge branch '2.8' into 3.4
* 2.8:
  [HttpKernel] fix forwarding trusted headers as server parameters
2018-08-24 16:37:40 +02:00
Nicolas Grekas
2554ad0698 bug #28241 [HttpKernel] fix forwarding trusted headers as server parameters (nicolas-grekas)
This PR was merged into the 2.8 branch.

Discussion
----------

[HttpKernel] fix forwarding trusted headers as server parameters

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28233, #28226, #28225, #28240
| License       | MIT
| Doc PR        | -

Commits
-------

92953485a5 [HttpKernel] fix forwarding trusted headers as server parameters
2018-08-24 16:33:48 +02:00
Nicolas Grekas
2beda894f2 [Messenger] Don't make EnvelopeItemInterface extend Serializable 2018-08-24 15:12:11 +02:00
Nicolas Grekas
c099d8675f Merge branch '4.1'
* 4.1:
  [travis] fix composer.lock invalidation for deps=low
  fix typo
2018-08-24 14:41:40 +02:00
Nicolas Grekas
f4c8311106 Merge branch '3.4' into 4.1
* 3.4:
  [travis] fix composer.lock invalidation for deps=low
2018-08-24 14:41:34 +02:00
Nicolas Grekas
24e8bc233c Merge branch '2.8' into 3.4
* 2.8:
  [travis] fix composer.lock invalidation for deps=low
2018-08-24 14:41:28 +02:00
Nicolas Grekas
77cd8b694a minor #28258 [travis] fix composer.lock invalidation for deps=low (nicolas-grekas)
This PR was merged into the 2.8 branch.

Discussion
----------

[travis] fix composer.lock invalidation for deps=low

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

Commits
-------

41ffba1916 [travis] fix composer.lock invalidation for deps=low
2018-08-24 14:40:49 +02:00
Nicolas Grekas
41ffba1916 [travis] fix composer.lock invalidation for deps=low 2018-08-24 14:37:56 +02:00
Nicolas Grekas
e675597d31 feature #27890 Mock date() in ClockMock (Dominic Tubach)
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
2018-08-24 14:14:29 +02:00
Nicolas Grekas
b6c2c46865 fix typo 2018-08-24 13:47:58 +02:00
Nicolas Grekas
ec51b2cc26 Merge branch '4.1'
* 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
2018-08-24 12:22:37 +02:00
Nicolas Grekas
51525e63f8 Merge branch '3.4' into 4.1
* 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
2018-08-24 12:22:26 +02:00
Nicolas Grekas
8b66cfca5a Merge branch '2.8' into 3.4
* 2.8:
  fix data mapper return type in docblock
  fix type error handling when writing values
2018-08-24 12:16:13 +02:00
Nicolas Grekas
b959d8594c feature #28218 Improve support for anonymous classes (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

Improve support for anonymous classes

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

Before:
![image](https://user-images.githubusercontent.com/243674/44276933-5c522600-a249-11e8-8bcc-6d55c9fa5a5e.png)

After:
![image](https://user-images.githubusercontent.com/243674/44276912-4cd2dd00-a249-11e8-943f-b6b0d0eb8908.png)

Same in other places, e.g. Console failures.

Commits
-------

e41ced2bfd Improve support for anonymous classes
2018-08-24 12:03:22 +02:00
Nicolas Grekas
771463123a cs fix 2018-08-24 12:01:11 +02:00
Nicolas Grekas
f03a54ed51 feature #28221 [DomCrawler] Add a way to filter direct children (Einenlum)
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
2018-08-24 12:00:10 +02:00
Einenlum
f634afdb6f [DomCrawler] Add a way to filter direct children 2018-08-24 11:59:58 +02:00
Nicolas Grekas
e18bf6eee0 bug #28220 [PropertyAccess] fix type error handling when writing values (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[PropertyAccess] fix type error handling when writing values

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

Commits
-------

45754515a5 fix type error handling when writing values
2018-08-24 11:57:25 +02:00
Nicolas Grekas
d8e2af32d8 feature #28234 [DI] Allow autowiring by type + parameter name (nicolas-grekas)
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
2018-08-24 11:56:33 +02:00
Nicolas Grekas
8860b6691c bug #28249 [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses (nicolas-grekas)
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
2018-08-24 11:47:29 +02:00
Nicolas Grekas
d446b6aefb bug #28252 [DoctrineBridge] support __toString as documented for UniqueEntityValidator (dmaicher)
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
2018-08-24 11:45:48 +02:00
David Maicher
2ac883a99b [DoctrineBridge] support __toString as documented for UniqueEntityValidator 2018-08-24 11:45:42 +02:00
Nicolas Grekas
a682051ecf minor #28255 [travis] enable Redis cluster (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[travis] enable Redis cluster

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

Will allow testing https://github.com/symfony/symfony/pull/28251 also

Commits
-------

f245df404f [travis] enable Redis cluster
2018-08-24 11:40:22 +02:00
Nicolas Grekas
f245df404f [travis] enable Redis cluster 2018-08-24 11:22:31 +02:00
Nicolas Grekas
8b59d177db [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses 2018-08-23 17:04:29 +02:00
Nicolas Grekas
c0b8f53bcb [DI] Allow autowiring by type + parameter name 2018-08-23 11:47:19 +02:00
Nicolas Grekas
92953485a5 [HttpKernel] fix forwarding trusted headers as server parameters 2018-08-22 17:45:23 +02:00
Nicolas Grekas
7b4e5cc50b Don't "replace" symfony/contracts 2018-08-22 08:18:58 +02:00
Nicolas Grekas
e41ced2bfd Improve support for anonymous classes 2018-08-21 14:03:16 +02:00
Nicolas Grekas
6a4de22787 bug #28228 [Validator] Fix precision issue regarding floats and DivisibleBy constraint (apfelbox)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Validator] Fix precision issue regarding floats and DivisibleBy constraint

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

Alternative to #28212

Commits
-------

ae04b48332 [Validator] Fix precision issue regarding floats and DivisibleBy constraint
2018-08-21 13:54:23 +02:00
Jannik Zschiesche
ae04b48332 [Validator] Fix precision issue regarding floats and DivisibleBy constraint 2018-08-20 16:30:22 +02:00
Fabien Potencier
0332f861c6 minor #28230 [Form] fix data mapper return type in docblock (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[Form] fix data mapper return type in docblock

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

Commits
-------

5bdc755d73 fix data mapper return type in docblock
2018-08-20 13:41:49 +02:00
Christian Flothmann
5bdc755d73 fix data mapper return type in docblock 2018-08-19 18:51:04 +02:00
Nicolas Grekas
2df7320c1c bug #28188 [Cache] make PhpMarshaller handle hard references (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Cache] make PhpMarshaller handle hard references

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

This PR makes the interface and behavior of `PhpMarshaller` cleaner and bullet-proof.
While a bug fix at this stage, I'd like to propose splitting it to a new `VarExporter` component all goes well.

Commits
-------

bc5d208584 [Cache] make PhpMarshaller handle hard references
2018-08-19 18:15:21 +02:00
Nicolas Grekas
df5525ff5f Merge branch '4.1'
* 4.1:
  [travis] fix composer.lock invalidation for PRs patching several components
2018-08-19 14:59:13 +02:00
Nicolas Grekas
0874f7098f Merge branch '3.4' into 4.1
* 3.4:
  [travis] fix composer.lock invalidation for PRs patching several components
2018-08-19 14:58:11 +02:00
Nicolas Grekas
817e7cdfaa Merge branch '2.8' into 3.4
* 2.8:
  [travis] fix composer.lock invalidation for PRs patching several components
2018-08-19 14:57:58 +02:00
Nicolas Grekas
48c531c09a [travis] fix composer.lock invalidation for PRs patching several components 2018-08-19 14:57:42 +02:00
Fabien Potencier
2d7aedba6e feature #28156 [Serializer] Fix the XML comments encoding (maidmaid)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Serializer] Fix the XML comments encoding

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

When we decode a XML comment, we get `['#comment' => ' foo ']`. But when we encode this same content, the result is not the expected one.

```php
$encoder->encode(['#comment' => ' foo '], 'xml');
```
```
Expected:
<response>
    <!-- foo -->
</response>

Actual:
<response>
  <item key="#comment"> foo </item>
</response>
```

Commits
-------

d94a37f395 Allow to encode xml comments
2018-08-19 13:10:28 +02:00