- Merge request !13406Non-string keys (int, etc.) cannot contain placeholders. β (Open) created by thejimbirch
When using createForEachIfNotExists or other actions that utilize CreateForEachBundle, a TypeError occurs if the config being processed contains fields that are defined as integer or boolean types in the config schema. The error is: "TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given"
1. Create a recipe with a createForEachIfNotExists action targeting node.type.* (Example)
2. Include config that has fields typed as integer or boolean in the config
schema (e.g., ai_automator config with weight: 100 and edit_mode: false)
3. Apply the recipe
4. Observe TypeError at CreateForEachBundle.php line 128
The CreateForEachBundle::replacePlaceholders() method recursively processes config data to replace placeholders like %bundle. When config is loaded and validated against schemas, fields typed as integer or boolean are converted from YAML strings to actual PHP integers and booleans. When the method encounters an array with integer keys (which can happen due to schema type conversion), it attempts to pass the integer key directly to str_replace() on line 128, which only accepts string or array types for its third argument.
Cast integer keys to strings before passing to str_replace(). Scalar types (int, bool, float, null) cannot contain placeholders anyway, so they should be returned unchanged.
Active
11.0 π₯
recipe system
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.