Skip to content

SQLSTATE[HY093]: Invalid parameter number #458

Open

Description

@feixuwork

Description

yiisoft/db-mysql/src/Schema.php 文件的 loadTableForeignKeys 方法中,SQL 查询使用了同一个参数名 :schemaName 两次,一次在 WHEN 子句中,一次在 WHERE 子句中。这导致PDO在参数绑定时出现错误

yiisoft/db-mysql/src/Schema.php 文件中重复使用了同一个参数名 :schemaName
修改了SQL查询,将重复的参数名改为不同的名称 :schemaName1 和 :schemaName2
更新了参数绑定代码以匹配修改后的查询

Package version

No response

PHP version

No response

Activity

  1. samdark commented on Dec 11, 2025

    @samdark
    Member

    Do you have time for a pull request containing tests and a fix? Thanks.

  2. vjik commented on Dec 11, 2025

    @vjik
    Member

    @feixuwork Can you show the error that PDO throws?

    PDO supports using the same named parameter multiple times, doesn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions