Hi,

I have added mailchimp module and created a field on my users account. I see this in the logs when I try to save the changes on the users edit page:

EntityMetadataWrapperException: Unknown data property field_newsletter. in EntityStructureWrapper->getPropertyInfo()

Any suggestions?

Thanks,
Paul.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ruscoe’s picture

Status: Active » Postponed (maintainer needs more info)

If possible, could you provide the full exception including the file and line number?

Aron Novak’s picture

I faced with the same issue, as I see by calling the EntityMetadataWrapper::value() , there is no guarantee that it will not result in an exception. It might be normal, it seems. I propose a patch, please review, maybe the solution is to patch the entity module, not Mailchimp.

Aron Novak’s picture

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

Status: Needs review » Needs work

The last submitted patch, 2: mailchimp_list_2310935_more_robust_value_access-2.patch, failed testing.

ruscoe’s picture

Version: 7.x-3.1 » 7.x-3.x-dev

Changing version to 7.x-3.x-dev as 3.1 tests were broken.

Status: Needs work » Needs review
joelpittet’s picture

Status: Needs review » Needs work
+++ b/modules/mailchimp_lists/mailchimp_lists.module
@@ -329,7 +329,22 @@ function _mailchimp_lists_subscription_has_changed($instance, $field, $entity, $
+        catch (Exception $err) {
+        }
...
+        catch (Exception $err) {
+        }

Any chance you'd like to watchdog those errors?

Aron Novak’s picture

Hm, likely not. In our use-case, we got exception on user page edits, every time for the country field for some users (not entirely sure what's the triggering condition). So I'd not be very happy on a crowded site to have such messages frequently. We test if the outcome is the same or not for the new and the old entity and we can test the outcomes now even we have an exception. Surely I have to admit the solution is not elegant as if somehow entity module breaks badly, we ignore this fact. I think the best would be to figure out if it's normal that entity module can throw an exception for such call, if not, then if it's the issue of the module that provides the field. In our case, the old entity did not have this field filled, so it may explain the error, but i could not reproduce this part consistently.

joelpittet’s picture

Tracking the message in the watchdog may help you narrow down the problem. Without that you are essentially just hiding/suppressing the problem, which is still happening. That failure could be a bigger problem that shows on the surface.

Entity API doesn't throw those exceptions for no reason.

It's looking for field_newsletter on some entity. It would be useful to know what entity it's try to get that field from so you can track down either why it's not there.

Aron Novak’s picture

For us, it happened with a countries field. So I think this is not some kind of "runtime" issue that belongs to the watchdog. I would be happy to figure out why this exception happens. I see two possibilities: either the module that provides the field, has a bug, or entity module has a bug , or Mailchimp module calls this value() method without checking something important. Why I am resistsant: we use it on a performance-sensitive site and it would be foolish to generate more noise and slow down a things a bit. So even if we watchdog() it, the underlying problem is not gone. I totally accept the point that discarding the error message is not perfect, but writing the watchdog when nothing strange happened (from the user point of view) seems to be strange either. I will try to spend some more time to figure out the real reason of this exception.

joelpittet’s picture

Having Exceptions suppressed doesn't really help performance either.
http://stackoverflow.com/a/17684984/80281

If you can fix the source of the problem you can have a much faster site;)

joelpittet’s picture

Category: Bug report » Support request

Moving this to a support request because I really don't think suppressing errors is a solution in any regard. The problem is the field is missing.

There may be a solution that could benefit everybody, but right now it just seems that fixing the missing field is all you can do.

It would be nice to get the full stack trace from @techypaul

ruscoe’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev

Moving this to 7.x-4.x as we're ending support for 7.x-3.x and this needs to be checked in the current release.

Greg Boggs’s picture

Category: Support request » Bug report
samuel.mortenson’s picture

Status: Needs work » Closed (outdated)

This code has changed a bit in 7.x-4.x and the patch no longer applies - if you're still seeing this issue with 7.x-4.x or 7.x-5.x please re-open the issue and upload a new patch. Thanks!