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

Open
opened 2026-01-22 16:00:58 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/753
Author: @powturns
Created: 8/12/2013
Status: Merged
Merged: 8/12/2013
Merged by: @guilhermeblanco

Base: masterHead: master


📝 Commits (1)

  • 27bae51 Modified executeInserts method in JoinedSubclassPersister to only check for the presence of columns in a composite primary key

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php (+1 -1)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/753 **Author:** [@powturns](https://github.com/powturns) **Created:** 8/12/2013 **Status:** ✅ Merged **Merged:** 8/12/2013 **Merged by:** [@guilhermeblanco](https://github.com/guilhermeblanco) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`27bae51`](https://github.com/doctrine/orm/commit/27bae51fa03628d6634925265ff33531573cd518) Modified executeInserts method in JoinedSubclassPersister to only check for the presence of columns in a composite primary key ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php` (+1 -1) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:00:58 +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#8661