When trying to export Drupal configuration with the Configuration module, I was getting the following errors:

Warning: get_class() expects parameter 1 to be object, array given in ctools_export_object() (line 902 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 934 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 934 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).

The problem is Configuration is creating its .inc files with

  public function getDataToSave() {
    $filename = $this->filename;
    ctools_include('export');
    $export = '$api = ' . $this->export($this->api_version) . ";\n\n";
    $export .= '$data = ' . ctools_export_crud_export($this->table, $this->data) . "\n\n";
    $export .= '$dependencies = ' . $this->export($this->dependencies) . ";\n\n";
    $export .= '$optional = ' . $this->export($this->optional_configurations) . ";\n\n";
    $export .= '$modules = ' . $this->export($this->required_modules) . ";";

    $file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n";

    $this->hash = sha1($file_contents);

    return $file_contents;
  }

which results in the case of Breakpoints group to

$api = '2.0.0';

$data = // Breakpoints.
$breakpoints = array();
$breakpoints[] = 'breakpoints.theme.classicaldiary.mobile';
$breakpoints[] = 'breakpoints.theme.classicaldiary.narrow';
$breakpoints[] = 'breakpoints.theme.classicaldiary.wide';

// Breakpoint group.
$breakpoint_group = new stdClass();
$breakpoint_group->disabled = FALSE; /* Edit this to true to make a default breakpoint_group disabled initially */
$breakpoint_group->api_version = 1;
$breakpoint_group->machine_name = '9_columns_4_orbit';
$breakpoint_group->name = '9 columns - 4 orbit';
$breakpoint_group->breakpoints = $breakpoints;
$breakpoint_group->type = 'custom';
$breakpoint_group->overridden = 0;


$dependencies = array();

$optional = array();

$modules = array(
  0 => 'ctools',
  1 => 'breakpoints',
);

Meaning the $data variable is actually an empty array instead of the $breakpoint_group object.

Patch following...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jibize’s picture

Instead of breakpoint_group_export_breakpoints() returning a variable name as a sting it returns the string representation of the breakpoints array.

attiks’s picture

I'll try to test this one of these days.

attiks’s picture

Assigned: Unassigned » Jelle_S
Status: Active » Needs review
Jelle_S’s picture

Assigned: Jelle_S » Unassigned
Status: Needs review » Fixed

Fixed in latest dev. Thanks for the patch! (I made some small changed to it)

Status: Fixed » Closed (fixed)

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