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

Make return value nullable #12713

Merged
merged 1 commit into from
Feb 21, 2023
Merged

Conversation

bencroker
Copy link
Contributor

@bencroker bencroker commented Feb 21, 2023

This PR fixes a bug in which a type error which is thrown if a multi select condition rule is added without any values, as reported in putyourlightson/craft-campaign#367. This is caused by OptionsFieldConditionRule::elementQueryParam having a strict return type of array, whereas the paramValue method has a nullable return type of ?array.

protected function elementQueryParam(): array
{
return $this->paramValue();
}

The error encountered is as follows.

2023-02-21 06:56:47 [web.ERROR] [TypeError] craft\fields\conditions\OptionsFieldConditionRule::elementQueryParam(): Return value must be of type array, null returned {"trace":["#0 /home/www/manufacture.scandella.fr/htdocs/vendor/craftcms/cms/src/fields/conditions/FieldConditionRuleTrait.php(115): craft\\fields\\conditions\\OptionsFieldConditionRule->elementQueryParam()","#1 /home/www/manufacture.scandella.fr/htdocs/vendor/craftcms/cms/src/elements/conditions/ElementCondition.php(181): craft\\fields\\conditions\\OptionsFieldConditionRule->modifyQuery()","#2 /home/www/manufacture.scandella.fr/htdocs/vendor/putyourlightson/craft-campaign/src/services/SegmentsService.php(142): craft\\elements\\conditions\\ElementCondition->modifyQuery()"

@bencroker bencroker requested a review from a team as a code owner February 21, 2023 22:19
@brandonkelly brandonkelly merged commit af80478 into craftcms:develop Feb 21, 2023
@brandonkelly
Copy link
Member

Thank you!

brandonkelly added a commit that referenced this pull request Feb 21, 2023
@brandonkelly
Copy link
Member

4.3.11 is out with that fix.

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

Successfully merging this pull request may close these issues.

2 participants