Opened 2 years ago

Last modified 2 years ago

#16698 new enhancement

Better Table field value upgrade check (minor)

Reported by: cogmios Owned by:
Priority: normal Milestone: Awaiting Review
Component: Warnings/Notices Version: 3.1
Severity: minor Keywords: needs-patch reporter-feedback
Cc: deleau@…

Description

line 1463 on /wp-admin/includes/upgrades.php is

preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i",$cfields[strtolower($tablefield->Field)], $matches);

$fieldtype = $matches[1];

There is no check IF a $matches is found. If there is no match found an error will be displayed 'undefined index 1'. An Error message could be added here.

Can happen : if the sql code contains no spaces between the fieldname and the type it will generate the not found [1].

Change History (2)

  • Component changed from General to Warnings/Notices
  • Keywords reporter-feedback added

Hi cogmios,

thanks for reporting the issue. Can you provide some steps on how to trigger the notice so to better look for a fix?

  • Cc deleau@… added

this should trigger it:

$sql = "CREATE TABLE $table_name_1 (
 id bigint(20) NOT NULL AUTO_INCREMENT,
 urivarchar(2048) COLLATE utf8_unicode_ci NOT NULL,
 favicon varchar(10) COLLATE utf8_unicode_ci NOT NULL,
 filters varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 content varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 defaulticon tinyint(1) NOT NULL,
 comment varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 icon_parent_id bigint(20) NOT NULL,
 itime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";

:) (no space before varchar, which is a mistake but the error message is confusing)

Note: See TracTickets for help on using tickets.