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

Model::getError() throws error when null #3934

Closed
samhernandez opened this issue Mar 1, 2019 · 0 comments
Closed

Model::getError() throws error when null #3934

samhernandez opened this issue Mar 1, 2019 · 0 comments

Comments

@samhernandez
Copy link
Contributor

Description

The deprecated craft\base\Model::getError() method has a string return type:

public function getError(string $attribute): string

However, it returns the result of the yii\base\Model::getFirstError() which can return null and throw a type error.

Steps to reproduce

  1. Create a public-facing user form
  2. Try to access a field error in Twig with user.getError('email')

Additional info

  • Craft version: 3.1.15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant