Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | mailchimp_list_2310935_more_robust_value_access-2.patch | 2.2 KB | Aron Novak |
Comments
Comment #1
ruscoe CreditAttribution: ruscoe commentedIf possible, could you provide the full exception including the file and line number?
Comment #2
Aron NovakI 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.
Comment #3
Aron NovakComment #5
ruscoe CreditAttribution: ruscoe commentedChanging version to 7.x-3.x-dev as 3.1 tests were broken.
Comment #7
joelpittetAny chance you'd like to watchdog those errors?
Comment #8
Aron NovakHm, 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.
Comment #9
joelpittetTracking 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.
Comment #10
Aron NovakFor 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.
Comment #11
joelpittetHaving 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;)
Comment #12
joelpittetMoving 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
Comment #13
ruscoe CreditAttribution: ruscoe at ThinkShout commentedMoving 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.
Comment #14
Greg BoggsComment #15
samuel.mortensonThis 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!