Skip to content
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

fix issue with integer indexed form children #7985

Merged
merged 2 commits into from
Dec 8, 2022

Conversation

dmaicher
Copy link
Contributor

@dmaicher dmaicher commented Dec 8, 2022

Subject

I am targeting this branch, because its BC and a bug fix.

Closes #7984

Changelog

### Fixed
- fixed an issue with integer indexed form children within `FormBuilderIterator`

@@ -53,4 +54,11 @@ public function testHasChildren(): void
$iterator = new FormBuilderIterator($this->builder);
static::assertTrue($iterator->hasChildren());
}

public function testCurrentWithIntegerIndexedChildren(): void
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fails without the fix

There was 1 error:

1) Sonata\AdminBundle\Tests\Util\FormBuilderIteratorTest::testCurrentWithIntegerIndexedChildren
TypeError: Symfony\Component\Form\FormBuilder::get(): Argument #1 ($name) must be of type string, int given, called in /var/www/SonataAdminBundle/src/Util/FormBuilderIterator.php on line 67

/var/www/SonataAdminBundle/vendor/symfony/form/FormBuilder.php:91
/var/www/SonataAdminBundle/src/Util/FormBuilderIterator.php:67
/var/www/SonataAdminBundle/tests/Util/FormBuilderIteratorTest.php:62
/var/www/SonataAdminBundle/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
/var/www/SonataAdminBundle/vendor/phpunit/phpunit/src/Framework/TestSuite.php:673
/var/www/SonataAdminBundle/vendor/phpunit/phpunit/src/Framework/TestSuite.php:673
/var/www/SonataAdminBundle/vendor/phpunit/phpunit/src/Framework/TestSuite.php:673

@dmaicher dmaicher added the bug label Dec 8, 2022
@dmaicher dmaicher marked this pull request as ready for review December 8, 2022 12:56
@dmaicher
Copy link
Contributor Author

dmaicher commented Dec 8, 2022

Weird failures seem unrelated

@VincentLanglet
Copy link
Member

Weird failures seem unrelated

Might be related to symfony/symfony#48422

Should be skip the test for now ?

@VincentLanglet
Copy link
Member

I'll take care of psalm

@VincentLanglet VincentLanglet merged commit dc8e065 into sonata-project:4.x Dec 8, 2022
@dmaicher dmaicher deleted the fix_issue_7984 branch December 8, 2022 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type error caused by FormBuilderIterator
2 participants