-
Notifications
You must be signed in to change notification settings - Fork 820
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
Unique indexes create server errors rather than form validation notices #10674
Comments
Just to be clear, you've mentioned |
I don't know. It is not my situation, other adaptors can be considered outside scope of this issue. If the intention is to throw the framework generic My intention with the comment was to perhaps provide a little "starting context" on how this problem exists. Unfortunately it may have distracted from the core of the issue, which is that a unique index gives a very poor experience when handling conflicts. Both as a developer and an administrator - arguably this could have been an issue on the CMS repo, but I think the issue is more relevant to validation issues in general than to usage of the CMS. I.e. I suppose one might reframe the issue as:
I see this as a gap in what the framework offers and thus should be extended to include. I hope that clarifies :) |
Affected Version
At least 4.11, possibly earlier versions (untested).
This may have worked in previous versions, as the way mysqli errors are delivered has changed in PHP 8, which may be the cause of this. c.f. #10570 for more detail.
Description
When marking a field as unique via the use of an index constraint, uncaught exceptions are thrown on a failed write due to a duplicate value. This causes an unfriendly system halt and "Server error" to be shown, as opposed to normal form feedback (e.g. in the CMS).
Steps to Reproduce
With both Framework & Admin installed:
Make a DataObject with a title field & unique index on Title
Make a ModelAdmin for that DataObject
Create an instance of the DataObject via the ModelAdmin with the Title "test"
Try to create a second instance of the DataObject via the ModelAdmin with the Title "test"
👀 "server error" toast message with no further info on how to validate the form.
The text was updated successfully, but these errors were encountered: