Modules like boxes allow their content to be exported. It is then stored as a multiple line variable eg.:

/**
 * Helper to implementation of hook_default_box().
 */
function _test_feature_default_box() {
  $export = array();
  $box = new stdClass;
  $box->disabled = FALSE; /* Edit this to true to make a default box disabled initially */
  $box->api_version = 1;
  $box->delta = 'boxy';
  $box->title = 'boxy';
  $box->description = 'test box';
  $box->body = 'line 1
line 2
line 3';
  $box->format = 1;

  $export['boxy'] = $box;
  return $export;
}

When one installs this as a feature for instance the box data is still fine. But when it is being rerolled ctools will re-export these variables, adding indentation to the lines again so this above will become:

**
 * Helper to implementation of hook_default_box().
 */
function _test_feature_default_box() {
  $export = array();
  $box = new stdClass;
  $box->disabled = FALSE; /* Edit this to true to make a default box disabled initially */
  $box->api_version = 1;
  $box->delta = 'boxy';
  $box->title = 'boxy';
  $box->description = 'test box';
  $box->body = 'line 1
  line 2
  line 3';
  $box->format = 1;

  $export['boxy'] = $box;
  return $export;
}

And so on on each consecutive feature roll, effectively changing the content. This is caused by adding the indentation prefix in ctools_var_export. I think it could be solved by simply adding a string flag to the export code, so multiple lines will not be prefixed with the indentation.

CommentFileSizeAuthor
#1 ctools_multiline_indent.patch943 bytessnufkin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

snufkin’s picture

Status: Active » Needs review
FileSize
943 bytes
mgriego’s picture

See: http://drupal.org/node/758750 which has a different patch for this same problem. The patch attached here can still result in indentation for scalars embedded in arrays.

snufkin’s picture

Status: Needs review » Closed (duplicate)

Yepp, i'll mark it as duplicate.