Expected argument of type "string", "null" given at property path "options". #2528
-
Hello! I'm trying to use CropperJS and other forms in the same page, but when submitting a form which is not the crop form, the crop form returns an error going by:
Here is my controller code: `<?php namespace App\Controller; use App\Entity\User; final class AppController extends AbstractController
}` Here's the link to reproduce the bug: https://github.com/LinkNexus/GamersWorld. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@LinkNexus, i moved your issue into discussions, as we now reserve the issues for bugs and RFC. There is an issue in your controller/page. You have 2 forms without names, so both are named... "form" (you can check in the HTML). So here, the cropForm believes it is submitted when you submit the other one, and the data is all mixed up. You can check this page for more information : https://symfony.com/doc/current/forms.html#changing-the-form-name |
Beta Was this translation helpful? Give feedback.
-
I’d like to add a quick comment regarding your reproducer. First, thank you for taking the time to create one and for clearly explaining where you thought the issue might be. This is always appreciated and makes troubleshooting much easier. That said, there are a couple of things that could have streamlined the process for me: 1. Include a READMEA README is invaluable for quickly understanding the problem, how to set up the project, and how to reproduce the issue. For example, I spent some time figuring out that fixtures needed to be loaded. A basic README could include steps like:
Additionally, including a direct URL to the relevant page would have saved time. For instance, when I tried /profile/1, I hit a type exception, which could have been avoided with clearer guidance. 2. Minimize noiseInclude only what's strictly necessary for reproducing the bug. Unrelated features or dependencies (like a mailer service, in this case) can create unnecessary clutter and complexity. Simplifying the reproducer often highlights the issue—nine times out of ten, you’ll discover the problem in the process of removing unrelated parts. For example, here, reducing the forms would likely have revealed that the component itself was working as intended. Thank you again for your effort, and I hope this feedback is helpful. Have a great day! |
Beta Was this translation helpful? Give feedback.
Okay thanks for the solution, i will keep these pieces of advice in memory for the next time i open an issue. Have a nice day also.