function node_type_save($info) {
  $is_existing = FALSE;
  $existing_type = !empty($info->old_type) ? $info->old_type : $info->type;
  $is_existing = (bool) db_query_range('SELECT 1 FROM {node_type} WHERE type = :type', 0, 1, array(':type' => $existing_type))->fetchField();
  $type = node_type_set_defaults($info);

Note $is_existing is initialized to FALSE and then set to the result of db_query_range().

CommentFileSizeAuthor
#1 1051870-double-init.patch767 bytesboombatower
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

boombatower’s picture

Assigned: Unassigned » boombatower
Status: Active » Needs review
FileSize
767 bytes
boombatower’s picture

Version: 7.x-dev » 8.x-dev

Commit to 8.x and backport.

RobLoach’s picture

#1: 1051870-double-init.patch queued for re-testing.

boombatower’s picture

Status: Needs review » Reviewed & tested by the community

Hopefully this isn't a stretch.

tstoeckler’s picture

+1 on RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Good catch. Committed to 7.x and 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.