Problem/Motivation
When using devel module to view tokens on an entity containing a custom field (path /devel/token/[entity_type]/[entity_id]), I see
TypeError: explode(): Argument #2 ($string) must be of type string, int given in explode() (line 433 of modules/composer/custom_field/src/Hook/TokenHooks.php).
The argument in question is an array key retrieved with findWithPrefix(). In the event that a token is of the format [entity:some_custom_field:0], the key would be "0", which PHP silently changes to 0, breaking the explode() call.
Proposed resolution
Cast the key as a string when calling explode().
Remaining tasks
Make a MR.
Issue fork custom_field-3578920
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
benstallings commentedComment #4
apmsooner commentedI was able to reproduce the bug and confirm the fix works. Thanks Ben!
Comment #7
apmsooner commented