8000 [3.2] Regression in Config or Yaml ? · Issue #20340 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[3.2] Regression in Config or Yaml ? #20340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
romainneutron opened this issue Oct 28, 2016 · 3 comments
Closed

[3.2] Regression in Config or Yaml ? #20340

romainneutron opened this issue Oct 28, 2016 · 3 comments

Comments

@romainneutron
Copy link
Contributor

Hello,

considering this code:

<?php

use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper;

require __DIR__.'/vendor/autoload.php';

class MyConfig implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('pipou');

        $rootNode
            ->useAttributeAsKey('name')
            ->prototype('array')
                ->prototype('array')
                    ->children()
                        ->scalarNode('didou')
                        ->end()
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
}

$dumper = new YamlReferenceDumper();

echo $dumper->dump(new MyConfig());

Until 3.1, this code worked well and outputs

pipou:

    # Prototype
    name:                 []

Since 3.2, it breaks:

PHP Fatal error:  Uncaught InvalidArgumentException: Child nodes must be named. in .../vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php:210
Stack trace:
#0 .../vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php(210): Symfony\Component\Config\Definition\ArrayNode->addChild(Object(Symfony\Component\Config\Definition\ArrayNode))
#1 .../vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php(64): Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper->getPrototypeChildren(Object(Symfony\Component\Config\Definition\PrototypedArrayNode))
#2 .../vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php(39): Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper->writeNode(Object(Symfony\Component\Co in .../vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php on line 210

As I'm not really aware of the internal changes of both Yaml and Config component, somebody might have an idea about the origin of this issue.

@ogizanagi
Copy link
Contributor

There are good chances this regression is due to #19480 😭

@ogizanagi
Copy link
Contributor

See #20341

@romainneutron
Copy link
Contributor Author

Yeah thanks @ogizanagi

@fabpot fabpot closed this as completed Oct 28, 2016
fabpot added a commit that referenced this issue Oct 28, 2016
This PR was squashed before being merged into the 3.2-dev branch (closes #20341).

Discussion
----------

Fix YamlReferenceDumper unnamed nested prototypes

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

Ideally, I'd like to output something like:

```yml
pipou:

    # Prototype
    name:

        # Prototype
        -
            didou:                ~
```

But for now, this should fix the regression.

Commits
-------

8e04643 Fix YamlReferenceDumper unnamed nested prototypes
symfony-splitter pushed a commit to symfony/config that referenced this issue Oct 28, 2016
This PR was squashed before being merged into the 3.2-dev branch (closes #20341).

Discussion
----------

Fix YamlReferenceDumper unnamed nested prototypes

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

Ideally, I'd like to output something like:

```yml
pipou:

    # Prototype
    name:

        # Prototype
        -
            didou:                ~
```

But for now, this should fix the regression.

Commits
-------

8e04643 Fix YamlReferenceDumper unnamed nested prototypes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0