[PR #753] JoinedSubclassPersister doesn't properly bind on some versions of php #8665

Closed
opened 2026-01-22 16:00:59 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/753

State: closed
Merged: Yes


I ran into this bug after deploying an application to production:

 An exception occurred while executing 'INSERT INTO TextSprite (id, text, fontId) VALUES (?, ?, ?)' with params ["4"]:

    SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

The parent table is being inserted properly (It's where the single param 4 comes from for the id), but the child table insert fails.

This was on a shared host with PHP version 5.3.24. On my development machine, everything works fine.

The issue is when the id is not a composite key, it's just a string (in this case), and for whatever reason !isset($id[$columnName]) fails to return a sane value on my production version of php.

By adding a check to see if the ID is an array we can determine if its a composite key, and not bother with the column checks if its not.

Not sure how to write unit tests for this one since it only affects certain versions of PHP (apparently). So advice on that is appreciated.

**Original Pull Request:** https://github.com/doctrine/orm/pull/753 **State:** closed **Merged:** Yes --- I ran into this bug after deploying an application to production: ``` An exception occurred while executing 'INSERT INTO TextSprite (id, text, fontId) VALUES (?, ?, ?)' with params ["4"]: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens ``` The parent table is being inserted properly (It's where the single param 4 comes from for the id), but the child table insert fails. This was on a shared host with PHP version 5.3.24. On my development machine, everything works fine. The issue is when the id is not a composite key, it's just a string (in this case), and for whatever reason !isset($id[$columnName]) fails to return a sane value on my production version of php. By adding a check to see if the ID is an array we can determine if its a composite key, and not bother with the column checks if its not. Not sure how to write unit tests for this one since it only affects certain versions of PHP (apparently). So advice on that is appreciated.
admin added the pull-request label 2026-01-22 16:00:59 +01:00
admin closed this issue 2026-01-22 16:00:59 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8665