Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.430
diff -u -p -r1.430 block.module
--- modules/block/block.module	24 Sep 2010 02:01:56 -0000	1.430
+++ modules/block/block.module	25 Sep 2010 19:24:45 -0000
@@ -219,10 +219,12 @@ function block_block_info() {
  * Implements hook_block_configure().
  */
 function block_block_configure($delta = 0) {
-  $custom_block = array('format' => filter_default_format());
   if ($delta) {
     $custom_block = block_custom_block_get($delta);
   }
+  else {
+    $custom_block = array();
+  }
   return block_custom_block_form($custom_block);
 }
 
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.345
diff -u -p -r1.345 filter.module
--- modules/filter/filter.module	24 Sep 2010 00:37:42 -0000	1.345
+++ modules/filter/filter.module	25 Sep 2010 19:42:14 -0000
@@ -751,8 +751,8 @@ function check_markup($text, $format_id 
  *   The form element to process. Properties used:
  *   - #base_type: The form element #type to use for the 'value' element.
  *     'textarea' by default.
- *   - #format: (optional) The text format id to preselect. If 0, NULL, or not
- *     set, the default format for the current user will be used.
+ *   - #format: (optional) The text format id to preselect. If NULL or not set,
+ *     the default format for the current user will be used.
  *
  * @return
  *   The expanded element.
@@ -820,9 +820,10 @@ function filter_process_format($element)
   }
 
   // Use the default format for this user if none was selected.
-  if (empty($element['#format'])) {
+  if (!isset($element['#format'])) {
     $element['#format'] = filter_default_format($user);
   }
+
   $element['format']['format'] = array(
     '#type' => 'select',
     '#title' => t('Text format'),
@@ -841,20 +842,27 @@ function filter_process_format($element)
     '#weight' => 0,
   );
 
-  // Lastly, disallow editing of this field if the user is not allowed to use
-  // the stored and preselected text format. But only, if that format actually
-  // exists.
   $all_formats = filter_formats();
-  if (!isset($formats[$element['#format']]) && isset($all_formats[$element['#format']])) {
+  $format_exists = isset($all_formats[$element['#format']]);
+  $user_has_access = isset($formats[$element['#format']]);
+  $user_is_admin = user_access('administer filters');
+
+  // If the stored format does not exist, administrators have to assign a new
+  // format.
+  if (!$format_exists && $user_is_admin) {
+    $element['format']['format']['#default_value'] = NULL;
+  }
+  // Disable this widget, if the user is not allowed to use the stored format,
+  // or if the stored format does not exist. The 'administer filters' permission
+  // only grants access to the filter administration, not to all formats.
+  elseif (!$user_has_access || !$format_exists) {
     // Overload default values into #value to make them unalterable.
     $element['value']['#value'] = $element['value']['#default_value'];
     $element['format']['format']['#value'] = $element['format']['format']['#default_value'];
 
     // Prepend #pre_render callback to replace field value with user notice
     // prior to rendering.
-    if (!isset($element['value']['#pre_render'])) {
-      $element['value']['#pre_render'] = array();
-    }
+    $element['value'] += array('#pre_render' => array());
     array_unshift($element['value']['#pre_render'], 'filter_form_access_denied');
 
     // Cosmetic adjustments.
Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.76
diff -u -p -r1.76 filter.test
--- modules/filter/filter.test	18 Sep 2010 02:18:35 -0000	1.76
+++ modules/filter/filter.test	25 Sep 2010 19:24:45 -0000
@@ -533,10 +533,35 @@ class FilterFormatAccessTestCase extends
     filter_format_disable($this->full_html_format);
     $this->resetFilterCaches();
 
-    // Verify that body field can be edited and a new format can be selected.
+    // Verify that the body field is now disabled, since the less privileged
+    // user should not be able to edit content that does not have an assigned
+    // format.
+    $this->drupalGet('node/' . $node->nid . '/edit');
+    $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), t('Text format access denied message found.'));
+
+    // Log back in as the administrator and verify that the body field can be
+    // edited.
+    $this->drupalLogin($this->admin_user);
     $this->drupalGet('node/' . $node->nid . '/edit');
     $this->assertNoFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", NULL, t('Text format access denied message not found.'));
     $this->assertFieldByXPath("//select[@name='$body_format_key']", NULL, t('Text format selector found.'));
+
+    // Verify that trying to save the node without selecting a new text format
+    // produces an error message, and does not result in the node being saved.
+    $old_title = $new_edit['title'];
+    $new_title = $this->randomName(8);
+    $edit = array('title' => $new_title);
+    $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+    $this->assertText(t('!name field is required.', array('!name' => t('Text format'))), t('Error message is displayed.'));
+    $this->drupalGet('node/' . $node->nid);
+    $this->assertText($old_title, t('Old title found.'));
+    $this->assertNoText($new_title, t('New title not found.'));
+
+    // Now select a new text format and make sure the node can be saved.
+    $edit[$body_format_key] = filter_fallback_format();
+    $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
+    $this->assertText($new_title, t('New title found.'));
+    $this->assertNoText($old_title, t('Old title not found.'));
   }
 
   /**
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.107
diff -u -p -r1.107 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	31 Jul 2010 13:01:50 -0000	1.107
+++ modules/taxonomy/taxonomy.admin.inc	25 Sep 2010 19:24:45 -0000
@@ -656,7 +656,7 @@ function taxonomy_form_term($form, &$for
     $defaults = array(
       'name' => '',
       'description' => '',
-      'format' => filter_default_format(),
+      'format' => NULL,
       'vocabulary_machine_name' => isset($vocabulary) ? $vocabulary->machine_name : NULL,
       'tid' => NULL,
       'weight' => 0,
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.65
diff -u -p -r1.65 user.install
--- modules/user/user.install	25 Sep 2010 18:10:53 -0000	1.65
+++ modules/user/user.install	25 Sep 2010 19:48:57 -0000
@@ -168,9 +168,8 @@ function user_schema() {
       ),
       'signature_format' => array(
         'type' => 'int',
-        'size' => 'small',
-        'not null' => TRUE,
-        'default' => 0,
+        'unsigned' => TRUE,
+        'not null' => FALSE,
         'description' => 'The {filter_format}.format of the signature.',
       ),
       'created' => array(
@@ -633,17 +632,47 @@ function user_update_7009() {
  * Update the {user}.signature_format column.
  */
 function user_update_7010() {
-  // It was previously possible for a value of "0" to be stored in database
-  // tables to indicate that a particular piece of text should be filtered
-  // using the default text format.
+  // In Drupal 6, the following situations could occur with text formats stored
+  // by modules in the database:
+  // - A value of "0" could be stored, indicating that a particular piece of
+  //   text would be filtered using whatever the site-wide default text format
+  //   was at the moment the text was being displayed.
+  // - A nonexistent text format could be stored (because the text format had
+  //   been deleted and the module did not have an opportunity to update its
+  //   data in response). This is the case for all contrib modules, but also
+  //   for the user signature format stored by core, due to a bug in Drupal 6
+  //   (http://drupal.org/node/863680). When filtering text with a nonexistent
+  //   format, Drupal 6 also treated it as though it had the site-wide default
+  //   format.
+  // In Drupal 7, all content must be stored with an explicit text format (or
+  // it will not be displayed when it is filtered). Therefore, to preserve the
+  // behavior of the site after the upgrade, we must replace all instances
+  // described above with the current value of the (old) site-wide default
+  // format at the moment of the upgrade.
+
+  // Remove DEFAULT '' NOT NULL from {users}.signature_format column.
+  db_change_field('users', 'signature_format', 'signature_format', array(
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => FALSE,
+    'description' => 'The {filter_format}.format of the signature.',
+  ));
+  // Replace signature_format with NULL for all empty user signatures.
+  db_update('users')
+    ->fields(array('signature_format' => NULL))
+    ->condition('signature', '')
+    ->execute();
+  // Replace signature_format with the default format for all non-empty user
+  // signatures.
+  $existing_formats = db_query("SELECT format FROM {filter_format}")->fetchCol();
   $default_format = variable_get('filter_default_format', 1);
   db_update('users')
     ->fields(array('signature_format' => $default_format))
-    ->condition('signature_format', 0)
+    ->isNotNull('signature_format')
+    ->condition('signature_format', $existing_formats, 'NOT IN')
     ->execute();
 }
 
-
 /**
  * Updates email templates to use new tokens.
  *
