WordPress.org

Make WordPress Core

Opened 8 weeks ago

Last modified 7 weeks ago

#43893 new defect (bug)

The maybe_create_table() function has two definitions

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: low
Severity: normal Version:
Component: Database Keywords: needs-patch
Focuses: Cc:

Description

The maybe_create_table() function has two definitions:

  1. https://github.com/WordPress/wordpress-develop/blob/c71a898f784d8435c07bcf9ec9e30560dd3abe19/src/wp-admin/includes/upgrade.php#L2187-L2219
  2. https://github.com/WordPress/wordpress-develop/blob/c71a898f784d8435c07bcf9ec9e30560dd3abe19/src/wp-admin/install-helper.php#L40-L70

The latter is contained within a function_exists() check, but this still means the function's behaviour can differ depending on which definition happens to load.

The function is not used at all in WordPress core. It (they?) should probably be deprecated.

Change History (2)

#1 @johnbillion
8 weeks ago

Oh, this applies to maybe_add_column() too. Again, not used in core.

#2 @subrataemfluence
7 weeks ago

Exactly. None of those functions are being used anywhere in the core. Also the comment in the first definition of maybe_create_table function is incorrect. It says:

This method checks for an existing database and creates a new one if it's not already present.

while it should be

This method checks for an existing table in the database and creates a new one if it's not already present.

May I please go for a patch? If yes, which function definition of the two to be considered for maybe_create_table?

Note: See TracTickets for help on using tickets.