SqlContentEntityStorage::cleanIds() hides errors

Created on 15 October 2014, almost 11 years ago
Updated 21 July 2025, about 1 month ago

Follow-up to #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID β†’

Problem/Motivation

After parent issue SqlContentEntityStorage::getFromStorage() silently removes non-integer IDs passed in without any warnings. That makes core unstable by hiding potential errors in code that use entity system.

Proposed resolution

1) Throw recoverable error in PHP.
2) Remove MySQL behavior (a clearing out non-integer entity IDs for integer columns) by finding actual code that converts inetgers to strings. Probably at DB layer (PDO).

Remaining tasks

1) decide on a error type, devs should be able to catch the errors ( #1795918: Can only flip STRING and INTEGER values! β†’ was so strict)
2) find the source of int=>string conversion, maybe another follow-up will be needed.
3) patch & commit

User interface changes

None.

API changes

tbd.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

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

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024