This PR was merged into the 2.7 branch.
Discussion
----------
Adding notes about deprecated warnings in 2.7
| 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
Hi guys!
When I upgraded, my project exploded with deprecated warnings. I'm certain we'll get a lot of questions about these, so I think we should try to get ahead of these questions as much as possible. I'm adding this - if I'm mistaken in anything, please let me know. I also think we should mention this in the release blog post so that people are aware.
I'm about to propose a short docs entry to explain things there too (so that hopefully if someone googles for the issue, they'll find our explanation).
Thanks!
Commits
-------
e374274 Adding notes about deprecated warnings in 2.7
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes#14762).
Discussion
----------
InvalidResourceException file name
Added filen ame to the InvalidResourceException,
Commits
-------
2e04e23 InvalidResourceException file name
This PR was merged into the 2.3 branch.
Discussion
----------
[Validators] Correct translation key and content [nl]
The nl file is not up to date. Correct changed translation key.
Commits
-------
5bc4085 [Validators] Correct translation key and content [nl]
This PR was merged into the 2.3 branch.
Discussion
----------
[Validators] Remove forgotten space in a translation key [nl]
The nl file is not up to date. Correct changed translation key.
Commits
-------
51e3c22 [Validators] Remove forgotten space in a translation key [nl]
This PR was merged into the 2.6 branch.
Discussion
----------
[Serializer] [2.6] Code style
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | none
This PR fixes some minor code style issues fabbot discovered while I was working on PR #14756.
Commits
-------
864136a Code style
This PR was merged into the 2.8 branch.
Discussion
----------
[Serializer] Support for array denormalization
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | none (yet)
This is a rebase of #14343 against the 2.8 branch.
I had to implement a couple of API endpoints that receive data as JSON-serialized arrays of objects. The current implementation of the Serializer component is capable of serializing such arrays, but so far this operation is a one-way-road. This PR is an attempt to change this.
## Demo
```php
class Dummy
{
public $foo;
public $bar;
public function __construct($foo = null, $bar = null)
{
$this->foo = $foo;
$this->bar = $bar;
}
}
$serializer = new \Symfony\Component\Serializer\Serializer(
array(
new \Symfony\Component\Serializer\Normalizer\PropertyNormalizer(),
new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer()
),
array(
new \Symfony\Component\Serializer\Encoder\JsonEncoder()
)
);
$json = $serializer->serialize(
array(
new Dummy('one', 'two'),
new Dummy('three', 'four')
),
'json'
);
echo $json . "\n\n";
// Deserialize the JSON string, so we get back to where we started from.
$data = $serializer->deserialize($json, 'Dummy[]', 'json');
var_dump($data);
```
By appending `[]` to the type parameter, you indicate that you expect to deserialize an array of objects of the given type. This is the same notation that phpDocumentor uses to indicate collections. The denormalization of the array is implemented recursively: The denormalizer simply calls `Serializer::denormalize()` on each element of the array. This way, the ArrayDenormalizer can be combined with any other denormalizer.
## Side effects
For this implementation, I had to touch `GetSetMethodNormalizer`, `PropertyNormalizer` and `CustomNormalizer`. Those classes expected `supportsDenormalization` to be called with a valid class in the `$type` parameter. Instead of throwing a reflection exception, they now simply return false. I'm not exactly sure, if this is should be considered to be a BC break.
This implementation violates the `SerializerInterface` which declared `deserialize()` to always return an object. But imho, the assumption that serialized data always represents an object is too restrictive anyway. Also, this declaration is not consistent with the `serialize()` method which accepts `mixed` as input type for the data to serialize.
## Other PRs
I've found an older PR adressing this issue, #12066. That PR was closed because the contributor did not reply to feedback.
Commits
-------
0573f28d Support for array denormalization.
* 2.3:
[Validators] Missing translations for arabic language.
fixed C
[HttpKernel][Bundle] Check extension implements ExtensionInterface
[HttpKernel] Do not call the FragmentListener if _controller is already defined
This PR was merged into the 2.3 branch.
Discussion
----------
n/a
n/a
Commits
-------
d320d27 [HttpKernel] Do not call the FragmentListener if _controller is already defined
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes#14757).
Discussion
----------
[Validators] Missing translations for arabic language.
| Q | A
| ---| ---------
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | ?
| Fixed tickets | none
| License | MIT
| Doc PR | none
This pull request is for adding missing translations in validators.ar.xlf.
Commits
-------
9a26e4b [Validators] Missing translations for arabic language.
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] AbstractNormalizer::instantiateObject allow default values when not optional
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR fixes a bug in the AbstractNormalizer when denormalizing a array with a missing value but a default value set in the class constructor.
Commits
-------
266d53e [Serializer] AbstractNormalizer::instantiateObject allow default values when not optional
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#14735).
Discussion
----------
[HttpKernel][Bundle] Check extension implements ExtensionInterface
- Avoid fatal errors on line 89 (calling getAlias on objects of
unknown type).
- Help developers solve problems with their extensions
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
b6e0a92 [HttpKernel][Bundle] Check extension implements ExtensionInterface
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes#14711).
Discussion
----------
[Serializer] AbstractNormalizer instantiateObject avoid `null` rejection
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR fixes a bug in the AbstractNormalizer when denormalizing a array with a null argument.
Commits
-------
d546080 [Serializer] AbstractNormalizer::instantiateObject avoid `null` rejection
* 2.6: (30 commits)
[Translation] fixed JSON loader on PHP 7 when file is empty
Fix typo
Check instance of FormBuilderInterface instead of FormBuilder
[Security] TokenBasedRememberMeServices test to show why encoding username is required
[Security] AbstractRememberMeServices::encodeCookie() validates cookie parts
fixed typo
[console][formater] allow format toString object.
[HttpFoundation] Fix baseUrl when script filename is contained in pathInfo
Avoid redirection to XHR URIs
[HttpFoundation] IpUtils::checkIp4() should allow networks
[2.6] Fix HTML escaping of to-source links
Fix HTML escaping of to-source links
ExceptionHandler: More Encoding
Fix the rendering of deprecation log messages
[FrameworkBundle] Removed unnecessary parameter in TemplateController
[DomCrawler] Throw an exception if a form field path is incomplete.
Fixed the indentation in the compiled template for the DumpNode
[Console] Delete duplicate test in CommandTest
[TwigBundle] Refresh twig paths when resources change.
WebProfiler break words
...
Conflicts:
src/Symfony/Bridge/Twig/composer.json
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
src/Symfony/Component/Debug/ExceptionHandler.php
* 2.3:
Fix typo
Check instance of FormBuilderInterface instead of FormBuilder
[Security] TokenBasedRememberMeServices test to show why encoding username is required
[Security] AbstractRememberMeServices::encodeCookie() validates cookie parts
[console][formater] allow format toString object.
[HttpFoundation] Fix baseUrl when script filename is contained in pathInfo
Avoid redirection to XHR URIs
[HttpFoundation] IpUtils::checkIp4() should allow networks
Fix HTML escaping of to-source links
[FrameworkBundle] Removed unnecessary parameter in TemplateController
[DomCrawler] Throw an exception if a form field path is incomplete.
[Console] Delete duplicate test in CommandTest
[TwigBundle] Refresh twig paths when resources change.
WebProfiler break words
fixed typo
Update README.md
[HttpKernel] Handle an array vary header in the http cache store
[Security][Translation] fixes#14584
[Framework] added test for Router commands.
Handled bearer authorization header in REDIRECT_ form
Conflicts:
src/Symfony/Component/Debug/ExceptionHandler.php
This PR was submitted for the 2.5 branch but it was merged into the 2.6 branch instead (closes#14726).
Discussion
----------
[Translation] fixed JSON loader on PHP 7 when file is empty
| 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
For PHP7 compat.
Commits
-------
af36c34 [Translation] fixed JSON loader on PHP 7 when file is empty
This PR was merged into the 2.3 branch.
Discussion
----------
[Form] Check instance of FormBuilderInterface instead of FormBuilder
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14714
| License | MIT
| Doc PR | -
Commits
-------
44469d0 Check instance of FormBuilderInterface instead of FormBuilder
This PR was merged into the 2.7 branch.
Discussion
----------
[2.7][DI] Definition deprecation notice includes the parameters given
| Q | A
| ------------- | ---
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #14687
| License | MIT
This PR won't fix the issue at hand, but should make it a bit easier to debug. Because this is used by the configuration loader, it's hard to trace back where and how it's actually used.
Commits
-------
b322d46 Definition deprecation notice includes the parameters given
This PR was merged into the 2.3 branch.
Discussion
----------
[Intl/DateFormatter] Fix typo unitialized vs. uninitialized
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
unitialized vs. uninitialized
Commits
-------
6ac8d29 Fix typo
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] SymfonyStyle : fix blocks failed when $messages is null
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Using `SymfonyStyle:block` method with `null` as first argument failed, where most of other methods accepting both string and array arguments will simply output an empty string.
At first I wanted to output nothing, or even throw a proper exception. But then I realized how behaves other methods like text or write.
I encountered this issue while executing a console application, in non-interactive mode, that asks questions (without default value) and prints the result immediately using a note block:
```php
$output->note($output->choice('Choice question', array('choice 1', 'choice 2'));
```
![screenshot 2015-05-16 a 11 42 47](https://cloud.githubusercontent.com/assets/2211145/7665616/ba5f343c-fbc0-11e4-811d-6b109aaa8d27.PNG)
Commits
-------
cfd1022 [Console] SymfonyStyle : fix blocks failed when $messages is null.