Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Form] Missing Data Handling (checkbox edge cases)#45081
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:7.4
Are you sure you want to change the base?
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
bb97fdb
toadb9016
Compare
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Sorry for the delay reviewing this, it's definitely interesting!
I force-pushed on your fork to turn the trait into a class. Please fetch + reset --hard before reopening the branch. There are some tests failing that need to be addressed.
I'm just wondering if this shouldn't go on 6.2: yes, this can be seen as a bug fix, but it's also a new behavior to me.
/cc @symfony/mergers WDYT?
Agree for 6.2 |
Tests for php >=8.1 are all green. |
Great thanks. OK to rebase+retarget for 6.2? |
d939f4f
toecce817
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM thanks!
the test failures look related |
Uh oh!
There was an error while loading.Please reload this page.
return $data; | ||
} | ||
} | ||
} catch (\Error $error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Catching type errors here doesn't look like the right solution to me. We should investigate instead why the$type
property inFormConfigBuilder
isn't initialized at this point and fix that root issue instead.
filiplikavcanAug 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't like it either.
Another solution could be to make FormConfigBuilderInterface::getType() nullable. Then null state would have to be handled in these methods where getType() is called:
ValidatorDataCollector#getCasters
FormDataExtractor#extractConfiguration
FormDataCollector#getCasters
FormTypeCsrfExtension#finishView
FormTypeCsrfExtension#buildForm
BaseType#buildView
Button#createView
I don't know if null/undefined type is a valid case or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I can look into why we run into this error here. But that will probably not happen before the weekend.
filiplikavcanAug 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Status: needs work |
Can you please rebase@filiplikavcan? |
Uh oh!
There was an error while loading.Please reload this page.
mpdude commentedSep 29, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
A form that consists of unchecked checkboxes only will not be recognized as being submitted with the standard If yes, you might want to mention#20210 in the list of tickets as well. Update: I have been looking at this code for over 10 minutes now and I am unable to figure out how it would be able to tell whether we're |
$missingData = $this->missingDataHandler->missingData; | ||
if ($missingData === $data = $this->missingDataHandler->handle($form, $request->query->all()[$name] ?? $missingData)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I cannot follow this code and would love if we could break this down into smaller chunks, maybe using expressive variable names.
filiplikavcanOct 4, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done. Is it easier to follow?
symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
Lines 60 to 69 in4dcd5a4
$missingData =$this->missingDataHandler->missingData; | |
$queryData =$request->query->all()[$name] ??$missingData; | |
$data =$this->missingDataHandler->handle($form,$queryData); | |
if ($missingData ===$data) { | |
// Don't submit GET requests if the form's name does not exist | |
// in the request | |
return; | |
} |
…equestHandler when handling GET requests)
5aad0a4
to4dcd5a4
Comparefiliplikavcan commentedOct 4, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think it would not be possible to tell the two situations apart. Look at this test: symfony/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php Lines 134 to 145 in4dcd5a4
|
Uh oh!
There was an error while loading.Please reload this page.