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

[4.x]: Attempt to fill/save an Email field throws "Unknown Method" error #10799

Closed
Nellyaa opened this issue Mar 22, 2022 · 2 comments
Closed

Comments

@Nellyaa
Copy link

Nellyaa commented Mar 22, 2022

What happened?

Description

When I try to fill an email field with an email it throws me a "Unknown Method" error.

Steps to reproduce

  1. Create email field and attach to global set or section
  2. Open entry/global and enter an email
  3. Click save and get exception

Expected behavior

Field gets saved and doesn't throw error :)

Actual behavior

After pressing save I get the following error:

Unknown Method – [yii\base\UnknownMethodException](http://www.yiiframework.com/doc-2.0/yii-base-unknownmethodexception.html)
Calling unknown method: craft\fields\Email::trim()

yii\base\UnknownMethodException: Calling unknown method: craft\fields\Email::trim() in /var/www/vendor/yiisoft/yii2/base/Component.php:300
Stack trace:
#0 /var/www/vendor/craftcms/cms/src/base/Element.php(2286): yii\base\Component->__call('trim', Array)
#1 /var/www/vendor/yiisoft/yii2/validators/InlineValidator.php(84): craft\base\Element->validateCustomFieldAttribute('field:email', Array, Object(yii\validators\InlineValidator), '[email protected]...')
#2 /var/www/vendor/yiisoft/yii2/validators/Validator.php(261): yii\validators\InlineValidator->validateAttribute(Object(craft\elements\Entry), 'field:email')
#3 /var/www/vendor/craftcms/cms/src/base/Element.php(2187): yii\validators\Validator->validateAttributes(Object(craft\elements\Entry))
#4 /var/www/vendor/yiisoft/yii2/base/Model.php(369): craft\base\Element->afterValidate()
#5 /var/www/vendor/craftcms/cms/src/services/Elements.php(2536): yii\base\Model->validate()
#6 /var/www/vendor/craftcms/cms/src/services/Elements.php(781): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), true, false, NULL)
#7 /var/www/vendor/craftcms/cms/src/controllers/ElementsController.php(1232): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#8 [internal function]: craft\controllers\ElementsController->actionApplyDraft()
#9 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /var/www/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#11 /var/www/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('apply-draft', Array)
#12 /var/www/vendor/craftcms/cms/src/web/Application.php(300): yii\base\Module->runAction('elements/apply-...', Array)
#13 /var/www/vendor/craftcms/cms/src/web/Application.php(604): craft\web\Application->runAction('elements/apply-...', Array)
#14 /var/www/vendor/craftcms/cms/src/web/Application.php(279): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#15 /var/www/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#16 /var/www/web/index.php(12): yii\base\Application->run()
#17 {main}

Craft CMS version

4.0.0-beta.2

PHP version

8.1.3

Operating system and version

Linux 5.10.16.3-microsoft-standard-WSL2

Database type and version

MySQL 10.7.3

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

  • Redactor 3.0.0-beta.1
  • Commerce 4.0.0-beta.1
@Nellyaa Nellyaa changed the title [4.x]: Attempt to fill/save an E-Mail field throws exception [4.x]: Attempt to fill/save an E-Mail field throws "Unknown Method" error Mar 22, 2022
@Nellyaa Nellyaa changed the title [4.x]: Attempt to fill/save an E-Mail field throws "Unknown Method" error [4.x]: Attempt to fill/save an Email field throws "Unknown Method" error Mar 22, 2022
brandonkelly added a commit that referenced this issue Mar 22, 2022
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 4.0.0-beta.3 is out now with the fix.

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

2 participants