Opened 4 months ago
Last modified 10 days ago
#61338 new defect (bug)
wpdb::prepare function null value convert to empty String
Reported by: | mazharul78 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Database | Keywords: | needs-patch |
Focuses: | Cc: |
Description
In WordPress core, there is an issue where prepare functions null values convert to empty strings when interacting with the database. This causes problems for database table columns defined with NOT NULL constraints, leading to the insertion of empty strings instead of retaining null values.
Attachments (2)
Change History (3)
@
4 months ago
The email column is not null, but inserting null into email results in an empty string.
#1
@
10 days ago
- Version 6.6 deleted
Hello @mazharul78,
Welcome to WordPress Core's Trac.
I'm doing triage on bugs reported against WP 6.6.x as part of the 6.6.x minor / maintenance release cycle.
In reviewing wpdb::prepare()
, I'm not finding any changes made to it during the 6.6 cycle. The only change made in the class was to remove back-compat support for database servers that don't support utf8mb4
(see #60096 / [57926]).
For now, I'll remove the Version
, as I'm not finding that WP 6.6 introduced the issue.
The database table contains three columns: id, name, and email. The id column is an auto-increment primary key. The name column is nullable, meaning it can contain null values. The email column is set to not null, ensuring that it always contains a value.