This PR was merged into the 3.3-dev branch.
Discussion
----------
[DX] Making the RegisterControllerArgumentLocatorsPass throw exception on bad types
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | maybe
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | n/a
Suppose you type-hint a controller arg with a non-existent class:
```php
public function fooAction(FakeClass $foo)
```
Current error:
> Class AppBundle\Controller\FakeClass does not exist
(from `ParamConverterListener`, and only when you hit that route)
New error:
> Cannot determine controller argument for "AppBundle\Controller\BlogController::indexAction()
": the $foo argument is type-hinted with the non-existent class or interface: "AppBundle\Con
troller\FakeClass". Did you forget to add a use statement?
(at build time)
The extra `Did you forget to add a use statement?` only shows up if it appears you likely forgot a `use` statement.
I think this will be a really common error (especially forgetting the `use` statement)... so let's make it a *really* nice error! An alternative would be to enhance the args resolver to throw a clearer exception when no arg can be wired and the type-hint is bad (we would also need to make the `ParamConverterListener` stop throwing the current error... so that the args resolver would have the opportunity to do that. Disadvantage would be that this error would only happen when you hit the route, not at build time.
Cheers!
Commits
-------
22b905226d Making the RegisterControllerArgumentLocatorsPass throw an exception on a bad type-hint
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22657#issuecomment-299728726
| License | MIT
| Doc PR | N/A
Same as #22657 for the renaming of `DebugAccessDecisionManager` into `TraceableAccessDecisionManager`. Indeed, I think we also require to redeclare the old `DebugAccessDecisionManager` for composer `classmap-authoritative` autoloading strategy & classmap dumper.
AppVeyor failures unrelated.
Edit: Re-thinking about it, it's probably not very common to dump the classmap and use the `classmap-authoritative` strategy when using those classes... That's to say: in debug mode/dev env. So it may be the reason why the class wasn't redeclared on contrary of `DefinitionDecorator`.
Commits
-------
5b123b9674 [Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Fix errors not rethrown even if not handled by console.error listeners
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/22678
| License | MIT
| Doc PR | n/a
https://github.com/symfony/symfony/pull/22261 has been squashed while revisiting error handling, this fixes it again while keeping latest changes intact.
__code__
```php
public function execute(InputInterface $input, OutputInterface $output) {
$this->barr();
}
public function bar() { }
```
__before__
![before](http://image.prntscr.com/image/38aa3b46fed6439ead693908ab104fb3.png)
__after__
![after](http://image.prntscr.com/image/071322bfa52247c6a02eac6ef9d8284a.png)
Commits
-------
75f098fcb8 Fix errors not rethrown even if not handled by console.error listeners
This PR was merged into the 3.3-dev branch.
Discussion
----------
Fixing a bug where abstract classes were wired with the prototype loader
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | n/a
The prototype/PSR-4 loader currently tries to wire abstract classes. The problem is if, for example, you have, for example:
```php
abstract class BaseCommand extends Command
{
}
```
If this is registered as a service, and you have `autoconfigure`, then the console `Application` will try to use this a command.
Was there some reason abstract classes were originally allowed to be registered as services with the PSR4/prototype loader? I don't know if there is a real use-case for registering abstract classes. If you wanted to use that service as a parent service... then you'll probably be configuring it yourself anyways. We could also fix this by changing all tags compiler passes to skip classes that are abstract... *if* there is a use-case for Abstract classes being auto-registered.
Cheers!
Commits
-------
5326bab10a Fixing a bug where abstract classes were wired
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Do not throw autowiring exceptions for a service that will be removed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no (arguable)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Hi guys!
tl;dr Do no throw a "Cannot autowire service id foo_bar" if that service (`foo_bar`) is private and is ultimately removed from the container.
I ran into a problem with the new PSR-4 service loader: our existing projects often contains directories with a mixture of services and model classes. In reality, that's not a problem: since the services are private, if any "extra" classes are registered as service, they're removed from the container because they're not referenced. In other words, the system is great: model classes do *not* become services naturally... because nobody tries to inject them as services.
However, if your model classes have constructor args... then things blow up on compilation. This fixes that: it delays autowiring errors until after `RemoveUnusedDefinitionsPass` runs and then does *not* throw those exceptions if the service is gone.
Cheers!
Commits
-------
f4913feaa8 Fixing a bug where services that were eventually removed could cause autowire errors
* 3.2:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
fixed CS
fixed CS
[DI] Fix PhpDumper blank lines around namespace
fixed CS
[Workflow] fix use directives
[Workflow] Move twig extension registration to twig bundle
Filesystem: annotate the one network test with a "network" group.
[DependencyInjection] Don't store default deprecation template in every service definition instance
* 2.8:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
* 2.7:
[Console] Do not duplicate Helper::strlen() code
[FrameworkBundle] Adding the extension XML
[Form] Minor: Fix comment in ChoiceType
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
This PR was merged into the 2.7 branch.
Discussion
----------
[FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/recipes/issues/46
| License | MIT
| Doc PR | N/A
As spotted in https://github.com/symfony/recipes/issues/46, there is no reason to call `registerBundles` on the kernel instance, as it's already booted. So we just have to use `getBundles` instead and `registerBundles` can be implemented in a non-rewindable way, as done with flex.
Commits
-------
040edfec4a [FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
This PR was merged into the 2.7 branch.
Discussion
----------
[Console] Do not duplicate Helper::strlen() code
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Commits
-------
01c2c099a4 [Console] Do not duplicate Helper::strlen() code
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#22676).
Discussion
----------
[FrameworkBundle] Adding the extension XML
| Q | A
| ------------- | ---
| Branch? | <3.3
| Bug fix? | yes
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
![XmlUtils](https://cloud.githubusercontent.com/assets/1810304/25841740/9b655036-34a1-11e7-9d1e-a23928b8ed17.png)
This pull request is referenced on ![symfony/skeleton](https://github.com/symfony/skeleton/pull/7)
<!--
- 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.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
6fe2ad0558 [FrameworkBundle] Adding the extension XML
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] Fix "Locale class not found" in AboutCommand
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Found testing http://fabien.potencier.org/symfony4-demo.html with docker `php:7.1`
Commits
-------
0269f9d422 [FrameworkBundle] Fix "Locale class not found" in AboutCommand
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fixed index args bug with ResolveNamedArgumentsPass
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | n/a
While upgrading a project, this code suddenly broke:
```yml
services:
ice_cream_service:
class: AppBundle\Service\IceCreamService
autowire: true
arguments:
1: 'http://api.example.com'
```
```php
class IceCreamService
{
public function __construct(EntityManager $em, $apiUrl)
{
}
}
```
Suddenly, the index `1` was not being mapped to `$apiUrl`. This was valid in 3.2, but broke when `ResolveNamedArgumentsPass` accidentally re-set the index. Simple fix :). Ping @dunglas
Cheers!
Commits
-------
7cc7c85919 Fixing bug where indexed args were set wrong in pass in some situations
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] Move twig extension registration to twig bundle
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | not really
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
It's probably very late, but I think the twig extension registration is supposed to be done from the `TwigBundle` rather than the `FrameworkBundle`. Fortunately, it doesn't cause any issue currently when using the framework bundle and the workflow component without twig, because it only creates a `workflow.twig_extension` service you'll probably never call, and the `twig.extension` tag is never processed. But still, creates a useless service that cannot be called (and is not removed because it's public).
So this PR aims for consistency over other twig extensions registration, and removing this service when not using twig.
It isn't a BC break to me, as you usually already use the `TwigBundle` for other extensions.
Commits
-------
3fc80d10ef [Workflow] Move twig extension registration to twig bundle
This PR was merged into the 3.3-dev branch.
Discussion
----------
[FrameworkBundle] KernelTestCase: allow to provide the kernel class with a var
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | no
| New feature? | yes, but must-have for the new project structure when using flex
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22661
| License | MIT
| Doc PR | todo in https://symfony.com/doc/current/testing.html#your-first-functional-test
So, when using flex, the new `phpunit.xml.dist` will be:
```diff
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
- <server name="KERNEL_DIR" value="etc/" />
+ <server name="KERNEL_CLASS" value="App\Kernel" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
```
As it may cause issues when refactoring, I added a `class_exists` check with an appropriate exception to indicate the class is either not found or not autoloadable.
Commits
-------
4f68912552 [FrameworkBundle] KernelTestCase: allow to provide the kernel class with a var
This PR was merged into the 3.2 branch.
Discussion
----------
[Workflow] fix use directives
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Spotted while creating https://github.com/symfony/symfony/pull/22652
Commits
-------
08f4ad2275 [Workflow] fix use directives
* 2.8:
fixed CS
[DI] Fix PhpDumper blank lines around namespace
fixed CS
Filesystem: annotate the one network test with a "network" group.
[DependencyInjection] Don't store default deprecation template in every service definition instance
This PR was merged into the 2.7 branch.
Discussion
----------
[DI] Fix PhpDumper blank lines around namespace
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
219bce9916 tries to fix CS in an expected PhpDumper output, which actually shows the PhpDumper does not create proper blank lines around the namespace.
That's why tests are failing on https://github.com/symfony/symfony/pull/22660.
Commits
-------
c9f6c1680f [DI] Fix PhpDumper blank lines around namespace
This PR was merged into the 3.3-dev branch.
Discussion
----------
Improved the stack traces that don't contain a function
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
When a trace doesn't have a method/function associated, we display `n/a` and the file path below it. This usually happens in the first line of the stack traces. I don't think this looks OK, so I'm proposing to change it as follows:
### Before
![before-exception](https://cloud.githubusercontent.com/assets/73419/25782450/ae521cc6-334b-11e7-9e22-b31342667f6c.png)
### After
![after-exception](https://cloud.githubusercontent.com/assets/73419/25782451/b1b9957e-334b-11e7-812f-8c24ab8872df.png)
Commits
-------
9457558457 Improved the stack traces that don't contain a function
This PR was merged into the 3.3-dev branch.
Discussion
----------
[WebLink][TwigBundle] Fix registration of the twig extension
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | See http://symfony.com/blog/new-in-symfony-3-3-weblink-component comments
| License | MIT
| Doc PR | N/A
BTW it is the only extension not using a classic service definition and adding the tag using the `Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass` class.
(Fabbot failure fixed in https://github.com/symfony/symfony/pull/22640)
Commits
-------
3d8a5646e7 [WebLink][TwigBundle] Fix registration of the twig extension
This PR was merged into the 3.3-dev branch.
Discussion
----------
Make the exception pages work when the WebProfilerBundle is not installed
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22631
| License | MIT
| Doc PR | -
Commits
-------
98353b0032 Make the exception pages work when the WebProfilerBundle is not installed
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI][DX] Fix missing autoconfigure in container debug
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Added missing autoconfigure flag for `debug:container` with service id.
Commits
-------
f50afad839 fixed missing autoconfigure in container debug
This PR was merged into the 3.3-dev branch.
Discussion
----------
[DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21369
| License | MIT
| Doc PR | N/A
The `return` trick doesn't seem to work, and php is still trying to declare the `DefinitionDecorator` class, which causes the "Cannot declare class ...\DefinitionDecorator, because the name is already in use" error because of the `class_alias` previously declared in `ChildDefinition.php`.
This never happens as soon as the `ChildDefinition` class is used first, as the alias will take hand, but their are some situations, like in some unit test cases it can happen apparently, because `DefinitionDecorator` is used first.
Commits
-------
530849e4b5 [DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use