- Issue created by @joshua1234511
- Merge request !105[3470873] Fixed TypeError: count(): Argument #1 ($value) must be of type... → (Open) created by joshua1234511
- Status changed to Needs review
4 months ago 3:30am 29 August 2024 - Status changed to Needs work
4 months ago 2:20pm 3 September 2024 - 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin
The solution is somewhat doubling the condition check and could be more performant by using nested checks:
instead of
// @@ -76,7 +76,8 @@ class DomainElementManager implements DomainElementManagerInterface { if ((isset($form[$field_name]['widget']['#options']) && count($form[$field_name]['widget']['#options']) === 0) || (isset($form[$field_name]['widget']['#options']) && count($form[$field_name]['widget']['#options']) === 1 && isset($form[$field_name]['widget']['#options']['_none'])) ) { $empty = TRUE;
maybe like:
// @@ -76,7 +76,8 @@ class DomainElementManager implements DomainElementManagerInterface { if ((isset($form[$field_name]['widget']['#options']) if (count($form[$field_name]['widget']['#options']) === 0) || (count($form[$field_name]['widget']['#options']) === 1 && isset($form[$field_name]['widget']['#options']['_none'])) ) ) { $empty = TRUE;
- 🇮🇷Iran amir jamshidi
I made this condition like this
if ((isset($form[$field_name]['widget']['#options']) && count($form[$field_name]['widget']['#options']) === 0) || (isset($form[$field_name]['widget']['#options']) && count($form[$field_name]['widget']['#options']) === 1 && isset($form[$field_name]['widget']['#options']['_none'])) ) { $empty = TRUE; }
While I can confirm the code in #5 does work on D10.3, it is simply a repetition of what's in the merge request mentioned in #3. I agree with dqd in #4 that the change could be rewritten, but the code in that comment isn't quite right and would be a breaking change, so I've tweaked it in the patch attached here, which does work for me.
- 🇺🇸United States earthday47 New York
Here's my +1 comment - We are experiencing this issue and I can confirm that the patch in #6 resolves it.