Make WordPress Core

Opened 8 weeks ago

#61338 new defect (bug)

wpdb::prepare function null value convert to empty String

Reported by: mazharul78's profile mazharul78 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.6
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)

table_column_structure.png (46.0 KB) - added by mazharul78 8 weeks ago.
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.
inserted_empty_string.png (20.1 KB) - added by mazharul78 8 weeks ago.
The email column is not null, but inserting null into email results in an empty string.

Download all attachments as: .zip

Change History (2)

@mazharul78
8 weeks ago

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.

@mazharul78
8 weeks ago

The email column is not null, but inserting null into email results in an empty string.

Note: See TracTickets for help on using tickets.