I was getting this error upon trying to edit a simple node that belongs to a workflow
EntityMetadataWrapperException: Unknown data property . in EntityStructureWrapper->getPropertyInfo() (line 351 of \sites\all\modules\entity\includes\entity.wrapper.inc).

So I exposed the error further with guidance from: https://www.drupal.org/node/1928884

Then I refresh my page, to see the following output:
(\sites\all\modules\workflow\workflow.module on line 940)
EntityMetadataWrapperException: Unknown data property . in EntityStructureWrapper->getPropertyInfo() (line 351 of \sites\all\modules\entity\includes\entity.wrapper.inc).

Then I visit workflow.module on line 940 to see the following lines

 // At this point, we may have redetermined and altered the field_name.
    if (!$sid && $field_name !== NULL) {
      $wrapper = entity_metadata_wrapper($entity_type, $entity);
      // Get State ID for existing nodes (A new node has no sid - will be fetched later.)
      // and normal node, on Node view page / Workflow history tab.
      $sid = $wrapper->{$field_name}->value();  /* ====Line 940====*/
    }

So I simply fix the error by adding an extra check:

if (!isset($field_name)) {
	$sid = $wrapper->{$field_name}->value();
}

Now Error disappeared

Phew!

Comments

bakr created an issue. See original summary.

bakr’s picture

Status: Reviewed & tested by the community » Needs review
parasolx’s picture

The error eliminate but state did not change. This is not the root of problem.

johnv’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hmm, but this is strange behaviour. See the complete code below.
The $field_name should either be space or contain a valid fieldname.

// If $field_name is not known, yet, determine it.
  if ($field_name === NULL) {
    $fields = _workflow_info_fields($entity, $entity_type);  // <=== Returns a list of workflow fields.
    if (count($fields)) {
      // Workflow Field API: if $field_name is not known, yet, determine it.
      $field = reset($fields);
      $field_name = $field['field_name'];
    }
    else {
      // Workflow Node API.
      $field_name = '';
    }
  }

  if ($field_name === '') {
    // Workflow Node API: Get current/previous state for a Workflow Node.
    // Multi-language not supported.
    // N.B. Do not use a page cache. This gives problems with Rules.
    $sid = isset($entity->workflow) ? $entity->workflow : FALSE;
  }
  else {
    // At this point, we may have redetermined and altered the field_name.
    if (!$sid && $field_name !== NULL) { // <== Sid is always FALSE, $field_name can't be NULL
      $wrapper = entity_metadata_wrapper($entity_type, $entity);
      // Get State ID for existing nodes (A new node has no sid - will be fetched later.)
      // and normal node, on Node view page / Workflow history tab.
      $sid = $wrapper->{$field_name}->value(); // <=== Line 940
    }
  }

The error is in the providing function _workflow_info_fields(). Is one of you able to debug that function?

Please state:
- which version of Drupal are you using?
- are you using workflow_fiekld or workflow_node?
- is this with any node, or in some special situation?
- I presume the Workflow is set up correctly?

mitokens’s picture

I started getting (almost) the same exact error when accessing any node that uses a workflow after recently updating to Workflow 7.x-2.5 on Drupal 7.41.

The description in /admin/modules led me to believe I should be using workflow_node and not workflow_field (at least for now).

The only difference I have from the OP's issue is that my error is thrown in entity.wrapper.inc on line 335:

318  /**
319   * Gets the info about the given property.
320   *
321   * @param $name
322   *   The name of the property. If not given, info about all properties will
323   *   be returned.
324   * @throws EntityMetadataWrapperException
325   *   If there is no such property.
326   * @return
327   *   An array of info about the property.
328   */
329  public function getPropertyInfo($name = NULL) {
330    $this->spotInfo();
331    if (!isset($name)) {
332      return $this->propertyInfo['properties'];
333    }
334    if (!isset($this->propertyInfo['properties'][$name])) {
335      throw new EntityMetadataWrapperException('Unknown data property ' . check_plain($name) . '.');
336    }
337    return $this->propertyInfo['properties'][$name] + $this->info['property defaults'] + $this->propertyInfoDefaults;
338  }

For the meantime I've employed the same hackaround as the OP, but I'd be interested in a proper fix.

johnv’s picture

@mitokens, is it still happening with the dev version?
today, there was another change in the code from #4.

johnv’s picture

Issue summary: View changes

Can someone also give a dpm (debug_backtrace ()) ?
( dpm needs devel module)

johnv’s picture

@mitokens, i dont understand why you are doubting. What was the submodule you were using before update? From which version do you come?

mitokens’s picture

I updated to Workflow 7.x-2.x-dev. I am no longer able to reproduce the error.

mitokens’s picture

(oops, ignore double-post.)

johnv’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Closing this very old issue.