WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37418 closed defect (bug) (duplicate)

upgrade.php raises Notice message when include by user.

Reported by: hogetan Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Database Keywords:
Focuses: Cc:

Description

I used dbDelta(), Notice was raised.

Notice: Undefined offset: 1 in /Users/yousan/Sites/example.com/wp-admin/includes/upgrade.php on line 2225

The code is lead by codex.

https://codex.wordpress.org/Creating_Tables_with_Plugins

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );

Attachments (1)

local_history1.patch (838 bytes) - added by hogetan 4 years ago.
Suppress Notice.

Download all attachments as: .zip

Change History (4)

@hogetan
4 years ago

Suppress Notice.

#1 @ocean90
4 years ago

  • Component changed from Administration to Database
  • Focuses administration removed
  • Keywords reporter-feedback has-patch needs-unit-tests added

@hogetan Thanks for your report and the patch. Can you provide the SQL query which you're using?

#2 @hogetan
4 years ago

@ocean90

CREATE TABLE `wp_answers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  `childmember_id` int(11) DEFAULT NULL,
  `nickname` varchar(45) DEFAULT NULL,
  `family_name` varchar(45) DEFAULT NULL,
  `first_name` varchar(45) DEFAULT NULL,
  `career` varchar(45) DEFAULT NULL,
  `certificate` varchar(512) DEFAULT NULL,
  `weight` float DEFAULT NULL,
  `height` float DEFAULT NULL,
  `sex` varchar(5) DEFAULT NULL,
  `age` varchar(5) DEFAULT NULL,
  `birthday` date DEFAULT NULL,
  `prefecture` varchar(45) DEFAULT NULL,
  `city` varchar(45) DEFAULT NULL,
  `address_1` varchar(255) DEFAULT NULL,
  `address_2` varchar(255) DEFAULT NULL,
  `answer01` tinyint(4) DEFAULT NULL,
  `deleted` tinyint(4) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  `check_date` datetime DEFAULT NULL,
  `remarks` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

#3 @ocean90
4 years ago

  • Keywords reporter-feedback has-patch needs-unit-tests removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

@hogetan Thanks.

This was already reported in #20263 and will be fixed in WordPress 4.6. See https://make.wordpress.org/core/2016/07/13/dbdelta-updates-in-4-6/ for more information about the changes.

Note: See TracTickets for help on using tickets.