Commit Graph

24608 Commits

Author SHA1 Message Date
Jakub Zalas
79a6a27e3f [Crawler] Remove a mention of an interface removed before a merge 2016-02-04 08:56:19 +00:00
Jakub Zalas
1183aca600 feature #17585 [DomCrawler] Abstract URI logic and crawl images (valeriangalliat)
This PR was squashed before being merged into the 3.1-dev branch (closes #17585).

Discussion
----------

 [DomCrawler] Abstract URI logic and crawl images

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

This is a backward-compatible version of #13620, and a rebase of #13649 on current `master`.

Commits
-------

1553b07  [DomCrawler] Abstract URI logic and crawl images
2016-02-04 08:44:00 +00:00
Valérian Galliat
1553b073fa [DomCrawler] Abstract URI logic and crawl images 2016-02-04 08:43:52 +00:00
Fabien Potencier
ba2552174d minor #17598 Improved FileResource and DirectoryResource (javiereguiluz)
This PR was squashed before being merged into the 3.1-dev branch (closes #17598).

Discussion
----------

Improved FileResource and DirectoryResource

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

Commits
-------

3e762a6 Improved FileResource and DirectoryResource
2016-02-03 13:36:08 +01:00
Javier Eguiluz
3e762a6f15 Improved FileResource and DirectoryResource 2016-02-03 13:36:07 +01:00
Nicolas Grekas
b33eb05b7c feature #17654 [Cache] Don't clone, serialize (nicolas-grekas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Cache] Don't clone, serialize

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

Cloning is not required by PSR-6, adds overhead and doesn't prevent any mistake for nested objects. Let's simplify.
ArrayCache in turn should store serialized by default, so that data is deep-cloned. But since this can cause a perf issue for some, I propose to add a constructor flag to disable serializing. WDYT?

Commits
-------

8605417 [Cache] Don't clone, serialize
2016-02-03 09:39:30 +01:00
Nicolas Grekas
8605417b55 [Cache] Don't clone, serialize 2016-02-03 09:37:11 +01:00
Kévin Dunglas
0bacababd9 feature #16947 [FrameworkBundle] PropertyInfo: register the SerializerExtractor (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #16947).

Discussion
----------

[FrameworkBundle] PropertyInfo: register the SerializerExtractor

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

Commits
-------

4422103 [FrameworkBundle] PropertyInfo: register the SerializerExtractor
2016-02-02 11:58:58 +01:00
Kévin Dunglas
4422103a9a [FrameworkBundle] PropertyInfo: register the SerializerExtractor 2016-02-02 11:58:55 +01:00
Fabien Potencier
83b53f4a89 feature #17611 [HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers (jakzal)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers

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

Commits
-------

a38d96e [HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers
2016-01-31 15:50:44 +01:00
Jakub Zalas
a38d96e504 [HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers 2016-01-31 11:38:53 +00:00
Fabien Potencier
8f3c06bb14 minor #17583 Introduce 3.1 and 4.0 upgrade files (xabbuh)
This PR was merged into the 3.1-dev branch.

Discussion
----------

Introduce 3.1 and 4.0 upgrade files

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

Commits
-------

f68e94a introduce 3.1 and 4.0 upgrade files
2016-01-29 09:15:08 +01:00
Christian Flothmann
f68e94a8cf introduce 3.1 and 4.0 upgrade files 2016-01-28 11:23:27 +01:00
Fabien Potencier
5b5970364e minor #17564 [Serializer] Use ::class in new tests (dunglas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Serializer] Use ::class in new tests

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/17446#discussion_r50965366
| License       | MIT
| Doc PR        | n/a

Commits
-------

48e8041 [Serializer] Use ::class in new tests
2016-01-27 16:30:34 +01:00
Fabien Potencier
7a965781b0 minor #17570 Change few occurences of a public setUp() method to protected (dunglas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

Change few occurences of a public setUp() method to protected

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

A new rule for fabbot.io 😊?

Commits
-------

31696b7 Change few occurences of a public setUp() method to protected
2016-01-27 16:25:00 +01:00
Kévin Dunglas
31696b7e98 Change few occurences of a public setUp() method to protected 2016-01-27 13:43:54 +01:00
Kévin Dunglas
48e8041611 [Serializer] Use ::class in new tests 2016-01-27 12:24:42 +01:00
Fabien Potencier
4f26a2e6e5 feature #14288 [Console] Add getters for Application::$autoExit and $catchExceptions (VasekPurchart)
This PR was submitted for the 2.7 branch but it was merged into the 3.1-dev branch instead (closes #14288).

Discussion
----------

[Console] Add getters for Application::$autoExit and $catchExceptions

There is currently no way to retrieve this information from Application (afaik) and since this can be set from outside (and is even part of the `@api`) it should be retrievable.

This might come handy for example when working with an Application instance inside your code - for example when creating a Console exception listener - then you need information about how the application was run.

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

Commits
-------

5d191d3 [Console] Add getters for Application:: and
2016-01-27 12:22:59 +01:00
Vasek Purchart
5d191d3cba [Console] Add getters for Application:: and 2016-01-27 12:22:49 +01:00
Fabien Potencier
26ad4ff93a feature #17504 [Console] Show code when an exception is thrown (maidmaid)
This PR was squashed before being merged into the 3.1-dev branch (closes #17504).

Discussion
----------

[Console] Show code when an exception is thrown

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

Hi !

When an exception is thrown, sf console doesn't show the code exception, while this code is very useful during developpement (for example, [guzzle put http status code in his code exception](https://github.com/guzzle/guzzle/blob/6.1.1/src/Exception/RequestException.php#L30-L33)).

I propose you that we show the code exception only when the code exception > 0 and with ``-v`` verbosity. It means :

- ``throw new Exception('Not found', 0)`` with normal verbosity --> no change
- ``throw new Exception('Not found', 0)`` with ``-v`` verbosity --> no change
- ``throw new Exception('Not found', 404)`` with normal verbosity --> no change
- **but** ``throw new Exception('Not found', 404)`` with ``-v`` verbosity --> showing :

![image](https://cloud.githubusercontent.com/assets/4578773/12530638/052991f2-c1e5-11e5-92f1-b7b3f60cc4ba.png)

Commits
-------

f8cd9e8 [Console] Show code when an exception is thrown
2016-01-27 05:55:20 +01:00
Dany Maillard
f8cd9e8263 [Console] Show code when an exception is thrown 2016-01-27 05:55:18 +01:00
Fabien Potencier
1525cce831 feature #17540 [WebProfilerBundle] Add HTTP return code in the Ajax request list table (kucharovic)
This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #17540).

Discussion
----------

[WebProfilerBundle] Add HTTP return code in the Ajax request list table

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

Commits
-------

9192e1b [WebProfilerBundle] Add HTTP return code in the Ajax request list table
2016-01-27 05:51:46 +01:00
Jakub Kucharovic
9192e1b34f [WebProfilerBundle] Add HTTP return code in the Ajax request list table 2016-01-27 05:51:46 +01:00
Fabien Potencier
cb16bffb28 feature #17446 [Serializer] Add PSR-6 adapter (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #17446).

Discussion
----------

[Serializer] Add PSR-6 adapter

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

- [x] Add tests

Commits
-------

4bf9d05 [Serializer] Add PSR-6 adapter
2016-01-27 05:42:02 +01:00
Kévin Dunglas
4bf9d05237 [Serializer] Add PSR-6 adapter 2016-01-27 05:42:01 +01:00
Fabien Potencier
127538ef26 feature #16917 [PropertyInfo] Cache support (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #16917).

Discussion
----------

[PropertyInfo] Cache support

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

Replace #16893 with several advantages:

- Less complex patch
- Work for all usages of PropertyInfo (even outside of the Serializer)
- Avoid a circular reference between Serializer's CallMetadataFactory and PropertyInfo's SerializerExtractor
- Allow @mihai-stancu's #16143 to work as-is

Commits
-------

86c20df [PropertyInfo] Cache support
2016-01-27 05:40:32 +01:00
Kévin Dunglas
86c20df53c [PropertyInfo] Cache support 2016-01-27 05:40:30 +01:00
Fabien Potencier
712eeed5bb minor #17549 [Validator] Minor fixes for the PSR-6 adapter (dunglas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Validator] Minor fixes for the PSR-6 adapter

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

Follows #17440. Take into account comments of @Tobion.

Commits
-------

aa60d5b [Validator] Minor fixes for the PSR-6 adapter
2016-01-27 05:36:25 +01:00
Fabien Potencier
52384fb85e minor #17550 [Validator] PSR-6 cache: Avoid name collision (dunglas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Validator] PSR-6 cache: Avoid name collision

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

See tests.

Commits
-------

12852c2 [Validator] PSR-6 cache: Avoid name collision
2016-01-27 05:34:32 +01:00
Kévin Dunglas
12852c2aea [Validator] PSR-6 cache: Avoid name collision 2016-01-26 20:26:38 +01:00
Kévin Dunglas
aa60d5be20 [Validator] Minor fixes for the PSR-6 adapter 2016-01-26 19:13:14 +01:00
Fabien Potencier
f1cdc6fd26 feature #17532 [Asset] Version as service (ewgRa)
This PR was squashed before being merged into the 3.1-dev branch (closes #17532).

Discussion
----------

[Asset] Version as service

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

While I working on #14832 I realize that all this problems and hidden magic can be avoided, if we will have ability to set asset version strategy as service.

This PR implementation of this idea.

Now it is possible to do something like this:

```yaml
framework:
    assets:
        version_strategy: assets.custom_version_strategy
        base_urls: http://cdn.example.com
        packages:
            foo:
                base_urls: ["https://example.com"]
                version_strategy: assets.custom_version_strategy
```

There is can be some conflicts with #16511 when it will be in master

Commits
-------

52d116b [Asset] Version as service
2016-01-26 13:34:43 +01:00
Evgeniy Sokolov
52d116bee5 [Asset] Version as service 2016-01-26 13:34:42 +01:00
Fabien Potencier
37f526467e feature #17440 [Validator] Add a PSR-6 adapter (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #17440).

Discussion
----------

[Validator] Add a PSR-6 adapter

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

Commits
-------

1f0ba00 [Validator] Add a PSR-6 adapter
2016-01-26 13:31:07 +01:00
Kévin Dunglas
1f0ba00109 [Validator] Add a PSR-6 adapter 2016-01-26 13:31:05 +01:00
Fabien Potencier
420989f5a9 feature #17113 [Serializer] Add a MaxDepth option (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #17113).

Discussion
----------

[Serializer] Add a MaxDepth option

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/14924#issuecomment-111977173, https://github.com/dunglas/DunglasApiBundle/issues/104#issuecomment-110644569
| License       | MIT
| Doc PR        | todo

Add a max depth option during the normalization process. Especially useful when normalizing trees.

Usage:

```php
use Symfony\Component\Serializer\Annotation\MaxDepth;

class MyObj
{
    /**
     * @MaxDepth(2)
     */
    public $foo;

    /**
     * @var self
     */
    public $child;
}

use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;

$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new ObjectNormalizer($classMetadataFactory);
$serializer = new Serializer(array($this->normalizer));

$level1 = new MyObj();
$level1->foo = 'level1';

$level2 = new MyObj();
$level2->foo = 'level2';
$level1->child = $level2;

$level3 = new MyObj();
$level3->foo = 'level3';
$level2->child = $level3;
$result = $serializer->normalize($level1, null, array(ObjectNormalizer::ENABLE_MAX_DEPTH => true));
/*      $result = array(
            'foo' => 'level1',
            'child' => array(
                    'foo' => 'level2',
                    'child' => array(
                            'child' => null,
                        ),
                ),
        );
*/
```

* [x] Metadata support
* [x] `@MaxDepth(2)` annotation and loader
* [x] XML loader
* [x] YAML loader
* [x] Delegate recursive normalization at the end of the process
* [x] Use constants with Late Static Binding in the abstract class instead of raw strings
* [x] Move common logic to the abstract class

/cc @mRoca @csarrazi

Commits
-------

a44bead [Serializer] Add a MaxDepth option
2016-01-26 13:18:18 +01:00
Kévin Dunglas
a44beade1e [Serializer] Add a MaxDepth option 2016-01-26 13:18:08 +01:00
Fabien Potencier
c5a78860f5 feature #17530 [Cache] Handle and log errors properly (nicolas-grekas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Cache] Handle and log errors properly

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

Best viewed ignoring white-spaces:
https://github.com/symfony/symfony/pull/17530/files?w=1

Commits
-------

d21fab0 [Cache] Handle and log errors properly
2016-01-26 08:03:55 +01:00
Nicolas Grekas
d21fab0d0b [Cache] Handle and log errors properly 2016-01-25 20:18:55 +01:00
Fabien Potencier
48d91a83b6 feature #17522 [Cache] Use generator in ArrayAdapter (gcds)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Cache] Use generator in ArrayAdapter

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

Commits
-------

367e784 [Cache] Use generator in ArrayAdapter
2016-01-25 15:53:15 +01:00
Aurimas Niekis
367e784f25 [Cache] Use generator in ArrayAdapter 2016-01-25 15:49:11 +01:00
Fabien Potencier
acfa9abfdc feature #16164 [Serializer] Add a data: URI normalizer (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #16164).

Discussion
----------

[Serializer] Add a data: URI normalizer

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

A new normalizer to transform `\SplFileInfo`, `\SplFileObject` and `\Symfony\Component\HttpFoundation\File\File` to [`data:` URI](https://en.wikipedia.org/wiki/Data_URI_scheme) and the opposite.

It's convenient when dealing with the JavaScript `FileReader` API.

Usage:

```php
$normalizer = new DataUriNormalizer();
echo $normalizer->normalize(new File(__DIR__.'/test.gif'));
// data:image/gif;base64,R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=

echo $normalizer->normalize(new File(__DIR__.'/test.txt'));
// data:text/plain,K%C3%A9vin%20Dunglas%0A

var_dump($normalizer->denormalize('data:image/gif;base64,R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=', 'SplFileObject');
// a SplFileObject (also supports HttpFoundation file if the composant is installed)
```
cc @clementtalleu

Commits
-------

cc7b5af [Serializer] Add a data: URI normalizer
2016-01-25 15:33:51 +01:00
Kévin Dunglas
cc7b5af170 [Serializer] Add a data: URI normalizer 2016-01-25 15:33:44 +01:00
Fabien Potencier
cda6cbafa3 feature #15279 Added {{ value }} message placeholder to UniqueEntityValidator (jperovic)
This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #15279).

Discussion
----------

Added {{ value }} message placeholder to UniqueEntityValidator

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

Apologize if I missed something. This is my first contribution to a large scale project.

Commits
-------

9cf1ce9 Added {{ value }} message placeholder to UniqueEntityValidator
2016-01-25 13:43:57 +01:00
Jovan Perovic
9cf1ce918d Added {{ value }} message placeholder to UniqueEntityValidator 2016-01-25 13:43:51 +01:00
Fabien Potencier
c650b8fa3e feature #16652 [console] Add truncate method to FormatterHelper (mheki)
This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #16652).

Discussion
----------

[console] Add truncate method to FormatterHelper

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

This PR adds a `truncate` method to `FormatterHelper`.
Message is truncated to the given length, then the suffix is appended to end of that string.
If the length is negative, number of letters to truncate is counted from the end of the message.
Suffix is always appended, unless truncate length is longer than message and suffix length.

Commits
-------

a16b1a0 [console] Add truncate method to FormatterHelper
2016-01-25 13:26:46 +01:00
Marek Pietrzak
a16b1a0228 [console] Add truncate method to FormatterHelper 2016-01-25 13:26:46 +01:00
Fabien Potencier
0d3bde8ae6 feature #17438 [Cache] Allow and use generators in AbstractAdapter (nicolas-grekas)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Cache] Allow and use generators in AbstractAdapter

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

The most important enhancement is allowing doFetch to return a generator, which wasn't possible before.
The other changes add strictness.

Commits
-------

0ba851a [Cache] Allow and use generators in AbstractAdapter
2016-01-25 13:23:12 +01:00
Fabien Potencier
05dfbdbf40 minor #16635 [Security] add USERNAME_NONE_PROVIDED constant (SofHad)
This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #16635).

Discussion
----------

[Security] add USERNAME_NONE_PROVIDED constant

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

I think that is better if we use a constant to define this string.

Commits
-------

3f60598 [Security] add USERNAME_NONE_PROVIDED constant
2016-01-25 13:06:56 +01:00
SofHad
3f605982e1 [Security] add USERNAME_NONE_PROVIDED constant 2016-01-25 13:06:55 +01:00