TypeError in CreateForEachBundle::replacePlaceholders() when processing config with integer or boolean schema types

Created on 3 October 2025, 10 days ago

Problem/Motivation

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"

Steps to reproduce

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

Root Cause:

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.

Proposed resolution

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.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

recipe system

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Pipeline finished with Failed
    10 days ago
    Total: 867s
    #617570
  • Pipeline finished with Success
    7 days ago
    Total: 525s
    #619936
  • Pipeline finished with Canceled
    6 days ago
    Total: 128s
    #620717
  • Pipeline finished with Canceled
    6 days ago
    Total: 460s
    #620719
  • Pipeline finished with Success
    6 days ago
    Total: 8402s
    #620737
Production build 0.71.5 2024