2

When trying to run a drush cron on a Drupal 7.54 site, I see the following error.

$ drush cron

WD cron: EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. Value at node(): . in [error] EntityDrupalWrapper->set() (line 756 of /var/www/html/sites/all/modules/contrib/entity/includes/entity.wrapper.inc). Cron run successful.

A similar error occurs in WatchDog when we try to search on any term:

$ drush wd-show --tail

641742 15/Feb 15:47 notice search Searched Content for test.
641743 15/Feb 15:47 error php EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. Value at node(): . in EntityDrupalWrapper->set() (line 756 of /var/www/html/

How do I begin to even understand how to investigate such an error? This seems to be an issue for a few other people too.

Misc: In this instance of D7.54, we have enabled: Entity Reference (entityreference) 7.x-1.2, Entity API (entity) 7.x-1.8, and - Entity tokens (entity_token) 7.x-1.8. We also running on RHEL 7.2 with PHP 5.4.16.

What I've tried so far: I have commented out this section of code (using a development copy):

<?php
/**
       * Overridden to support setting the entity by either the object or the id.
       */
  public function set($value) {

    if (!$this->validate($value)) {
       /*throw new EntityMetadataWrapperException(t('Invalid data value given. Be sure it matches the required data type and format. Value at !location: !value.', array(
        // An exception's message is output through check_plain().
        '!value' => is_array($value) || is_object($value) ? var_export($value) : $value,
        '!location' => $this->debugIdentifierLocation(),
      )));*/
    }

But this is obviously not a sustainable exercise. It does seem to at least produce the results.

enter image description here

Question: Short of changing the module code myself -- not a great option -- what other options could I employ? Is there a way to rescue search page without directly editing this module?

Update: So this works if I allow searches only on users. The error is thrown when Content is searched.

2
  • 2
    You could use the php function debug_backtrace(). Print its content either to the screen or to the watchdog log: watchdog('my debug', print_r(debug_backtrace(), TRUE));. Add such a line to entity.wrapper.inc right before line 756 and it should give you the chain of all calling functions and parameters. If the page crashes, you can use debug_backtrace's limit paramter to cut the output. Commented Feb 15, 2017 at 22:56
  • Have a look at @kenorb answer to a similar question I asked sometimes ago. Really detailed and useful : drupal.stackexchange.com/questions/111610/…
    – Kojo
    Commented Feb 18, 2017 at 22:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.