When syncing a new node from Alfresco to Drupal, the following strict warning occurs:

Strict warning: Creating default object from empty value in _cmis_sync_cmis_drupal_prepare() (line 276 of C:\hubnet\drupal-7.10\sites\all\modules\cmis\cmis_sync\cmis_sync.cmis.inc).

The code in question is (in cmis_sync.cmis.inc):

    // load Drupal node
    $node = node_load($drupal_nid);
    $node->type = $node_type;

This warning can be removed by changing this code to:

    // load Drupal node
    $node = node_load($drupal_nid);
    if ($node === false) $node = (object) NULL;
    $node->type = $node_type;

Comments

IanNorton’s picture

Assigned: Unassigned » IanNorton
Status: Active » Closed (cannot reproduce)

Hi,

I can't reproduce this, it's possible that it's been fixed as part of some other changes, but I'd like to confirm that by checking the settings that you've got in settings.php:

$conf['cmis_sync_map'] = array(
  'page' => array(
    'enabled' => TRUE,
    'cmis_folderPath' => '/Sites/marketing/documentLibrary/Web',
  ),
);

Can you also confirm that you're testing this with the latest 7.x-1.x-dev code branch?

Thanks,

Ian

soundasleep’s picture

Status: Closed (cannot reproduce) » Active

Sorry for not replying earlier, I hadn't configured Drupal.org to notify me of issue changes via e-mail...

Yes, this issue still occurs. Have you enabled E_ALL error notifications? In fact, we get two warnings:

    Warning: Creating default object from empty value in _cmis_sync_cmis_drupal_prepare() (line 241 of C:\hubnet\drupal\sites\all\modules\cmis\cmis_sync\cmis_sync.cmis.inc).
    Notice: Undefined property: stdClass::$body in _cmis_sync_drupal_node_field_value() (line 209 of C:\hubnet\drupal\sites\all\modules\cmis\cmis_sync\cmis_sync.drupal.inc).

However I independently rewrote my fix to satisfy another warning:

    // load Drupal node
    $node = node_load($drupal_nid);
    if (!$node) {
    	// the node doesn't exist yet: but it's OK, we don't need to have a
    	// node template. but, we should at least create the new object so we
    	// don't get the warning "Warning: Creating default object from empty value".
    	$node = new stdClass();

    	// to prevent Notice: Undefined property: stdClass::$body in _cmis_sync_drupal_node_field_value()
    	$node->body = NULL;
    }
    $node->type = $node_type;

Excerpt from our settings.php:

$conf['cmis_repositories'] = array(
        'default' => array(
                'user' => 'cmis-user',
                'password' => 'cmis',
                'url' => 'http://localhost:8080/alfresco/s/cmis'

        )
);

$conf['cmis_sync_map'] = array(
       'cmis_content' => array(
                'enabled' => TRUE,
        'cmis_folderPath' => '/Publish',
        'subfolders' => TRUE,
                'deletes' => TRUE,
        'cmis_sync_nodeapi_enabled' => FALSE
    )
);
brassington’s picture

Version: 7.x-1.x-dev » 7.x-1.2

I'm running into both of these warnings as well, but I'm using the 7.x-1.2 branch, from the fork provided by thehideki.

But when I implement the changes recommended above to cmis_sync.cmis.inc, I still don't have CMIS to Drupal syncing, but the error messages are gone.

kimberleycgm’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new490 bytes

Adding a patch for the above - just create an empty object if the node doesn't already exist.