Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

CustomField: sizeof(): Parameter must be an array or an object that implements Countable #16

Open
jamesgraham opened this issue Sep 2, 2019 · 1 comment · May be fixed by #17
Open

Comments

@jamesgraham
Copy link

This is happening with various API calls and makes the library unusable.

In CustomField, we have

$field = CRM::fieldList('customFieldDefinition', $idOrName, true);

Since it then tries to do a sizeof on that field, and this field can be an object of type BareResource, we get a fatal error.

@jamesgraham
Copy link
Author

Worth noting I am running PHP 7.2.15 - maybe this behaviour worked before with an older version?

The issue is also in Endpoint search method, it tries to count a BareResource object:
} while ($allPages && sizeof($results) >= $safeLimit && ++$params['page_number']);

Perhaps a quick workaround to to make BareResource implement Countable and return a count of 1?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant