phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\BindTypeRequiresArray

Bind type requires an array in placeholder

Error message

Bind type requires an array in placeholder: {name}

What it means

Thrown when a placeholder declared as array/array-str/array-int has a bound value in this->bindParams but that value is not a PHP array, so the query cannot expand it into a parenthesized value list for IN-style conditions.

Solutions

  1. Pass an array as the bound value, e.g. ['ids' => [1,2,3]] with bind type array-int.
  2. If you intended a single value, use a scalar bind type (BIND_PARAM_STR/BIND_PARAM_INT) instead of an array type.
  3. Cast or wrap the value: [(array) $value] before binding.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:2181 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/60a96992a5d4d560. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model/Query.zep:2181

                            case "null":
                                let this->bindTypes[name] = Column::BIND_PARAM_NULL;

                                let exprReturn = [
                                    "type":  "placeholder",
                                    "value": ":" . name
                                ];

                                break;

                            case "array":
                            case "array-str":
                            case "array-int":
                                if unlikely !fetch bind, this->bindParams[name] {
                                    throw new BindValueRequired(name);
                                }

                                if unlikely typeof bind != "array" {
                                    throw new BindTypeRequiresArray(name);
                                }

                                if unlikely empty bind {
                                    throw new EmptyArrayPlaceholderValue(name);
                                }

                                let exprReturn = [
                                    "type":     "placeholder",
                                    "value":    ":" . name,
                                    "rawValue": name,
                                    "times":    count(bind)
                                ];

                                break;

                            default:
                                throw new UnknownBindType(bindType);
                        }

View on GitHub (pinned to b7419de9cd)