-
Notifications
You must be signed in to change notification settings - Fork 167
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
Issue #3332947 by zanvidmar: Mentions filter throws an error if NULL ... #3319
Conversation
…nstead of string.
Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊 |
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
3 similar comments
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
I am closing this PR because of #3322 which is fixing the issue without breaking changes. |
Problem
In the mention filter method
getMentions(string $text)
only strings are accepted. It can not be guaranteed that all sting fields will return an empty string''
when they are left empty. WhenNULL
is providedgetMentions()
throws an error.Error:
Solution
Allow that
$text
variable can be alsoNULL
bygetMentions(?string $text)
and add return empty array like it is shown below.empty($text)
was deliberately chosen over$text === NULL
because there is also no value in processing an empty sting.Issue tracker
3332947
Theme issue tracker
N/A
How to test
[Required] For example
TypeError: Drupal\mentions\Plugin\Filter\MentionsFilter::getMentions(): Argument #1 ($text) must be of type string, null given
is triggeredDefinition of done
Before merge
After merge
Screenshots
N/A
Release notes
Fix Mentions prevents saving of content with empty text field
Change Record
N/A
Translations
N/A
translations.php
file.