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

[SymfonyForm] Updating to 4.4.9 crash with Unable to get a property on a non-object. #37072

Closed
VincentLanglet opened this issue Jun 2, 2020 · 17 comments

Comments

@VincentLanglet
Copy link
Contributor

Symfony version(s) affected: 4.4.9

Description

I'm using a childAdmin with Sonata
https://symfony.com/doc/master/bundles/SonataAdminBundle/reference/child_admin.html

When I'm on a playList/idPlaylist/video/create url and try to submit the form to create a video and add it to the playlist, I get Unable to get a property on a non-object..

Everything worked fined with symfony-form@4.4.8, but when I update to 4.4.9 I get an error.

Additional context
image

@xabbuh
Copy link
Member

xabbuh commented Jun 2, 2020

Can you create a small example application that allows to reproduce the issue?

@VincentLanglet
Copy link
Contributor Author

Is that https://github.com/ak3l/symfony4/pull/33 enough ? @xabbuh

@xabbuh
Copy link
Member

xabbuh commented Jun 2, 2020

I will try to look at it. Maybe this is also "just" the same as (or related to) #37025 and #37027?

@VincentLanglet
Copy link
Contributor Author

I tried #37027 (comment)
And it didn't fix my issue.

It certainly related to the same PR, but I preferred to open a separate issue since the error message wasn't the same.

I've made some investigation
https://github.com/ak3l/symfony4/pull/33#issuecomment-637688634

I can't really do more...

@xabbuh
Copy link
Member

xabbuh commented Jun 3, 2020

Can you check if #37085 fixes this by chance?

@VincentLanglet
Copy link
Contributor Author

@xabbuh I tried editing my vendor with your changes, I still get the error

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

I tried to checkout your example, but didn't manage to do so. Can you reduce it a bit so that I don't need stuff like Homestead and Vagrant and/or can you post the exact error and the stack trace of the exception?

@VincentLanglet
Copy link
Contributor Author

I tried to checkout your example, but didn't manage to do so. Can you reduce it a bit so that I don't need stuff like Homestead and Vagrant and/or can you post the exact error and the stack trace of the exception?

I never made a symfony project without a vagrant... What was the issue you encountered ?
This project needs a database, I don't know how to do another way.

Maybe if you provide me a Symfony 4 project with a database which is working on your device, I can reproduce the error. @xabbuh

The exact error and the stack trace are in the screenshot.
It's coming from the FormValidator line 141.

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

Maybe if you provide me a Symfony 4 project with a database which is working on your device, I can reproduce the error. @xabbuh

You can try the Symfony Demo application. It comes with an Sqlite database which can easily be used on any computer.

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

@VincentLanglet Please do not spend too much time right now on the example application. I am looking into the ExpressionLanguage constraint you mentioned above to see if I can reproduce it without all the rest.

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

Status: Reviewed

@VincentLanglet
Copy link
Contributor Author

@VincentLanglet Please do not spend too much time right now on the example application. I am looking into the ExpressionLanguage constraint you mentioned above to see if I can reproduce it without all the rest.

If you still need one, I've made https://github.com/VincentLanglet/demo/pull/1 @xabbuh

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

Can you try if #37103 fixes this?

@VincentLanglet
Copy link
Contributor Author

Can you try if #37103 fixes this?

It does on my demo. I will try tomorrow with the project I use for work, but I think you've found the solution :)

@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

Thank you! :) No we "just" need to write some tests to prevent future regressions.

@VincentLanglet
Copy link
Contributor Author

@xabbuh I just tried on the project I use for work. It does definitely fix the bug :)

@xabbuh
Copy link
Member

xabbuh commented Jun 5, 2020

@VincentLanglet Thank you! :)

@fabpot fabpot closed this as completed Jun 12, 2020
fabpot added a commit that referenced this issue Jun 12, 2020
…bbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Form] switch the context when validating nested forms

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37072
| License       | MIT
| Doc PR        |

Commits
-------

38135de switch the context when validating nested forms
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