-
Notifications
You must be signed in to change notification settings - Fork 642
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
[4.x]: Fields with enum as value type fail while saving #12297
Comments
Thanks for reporting and for the sample code! It was very helpful. I've opened a PR for this. We can't fully support enums until we require 8.1 but it should help out in the mean time. |
Craft 4.3.2 is out with that fix. |
@brandonkelly looks like your change in a4303f1 this broke my enum fields :(
|
8.1+ reports for |
@gglnx Doh, |
What happened?
Description
I've build an field type which uses an enum as value type. While saving
craft\services\Elements::duplicateElement()
at line 1461 tries to clone the enum, but cloning of enums is not supported by PHP. A simple check withinstanceof \UnitEnum
(https://www.php.net/manual/en/class.unitenum.php) should fix that.Steps to reproduce
Craft CMS version
4.3.1
PHP version
8.1.11
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: