In the same test as #1049072: Lack of faces.inc in test enviroment I'm getting also this error afterwards

Fatal error: Call to undefined function entity_get_property_info() in sites/all/modules/entity/includes/entity.wrapper.inc on line 550

I've tried to solve it the same way as the other, including the entity.property.inc in the info file:

files[] = includes/entity.property.inc

But it keeps failing

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pcambra’s picture

Status: Active » Closed (won't fix)

This was an unrelated problem.

mikeryan’s picture

@pcambra - can you explain what the unrelated problem was? I've been having similar issues with FacesExtendable, and now I'm getting the entity_get_property_info() error, so I seem to be going down the same road you did...

Thanks.

Liliplanet’s picture

Priority: Normal » Major
Status: Closed (won't fix) » Active

subscribe thx!

had the FacesExtendable and now site unavailable with Fatal error: Call to undefined function profile2_type_access() in /home/public_html/sites/all/modules/entity/entity.module on line 418

looking forward to any reply and thank you.

somehow go fixed by disabling rules, privatemsg, profile2 and entity in phpmyadmin.

fago’s picture

Status: Active » Fixed

this should be fixed with the recent rules module, please re-open if problems persist.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dernetzjaeger’s picture

I have the same message.

Fatal error: Call to undefined function entity_get_property_info() in sites/all/modules/entity/includes/entity.wrapper.inc on line 595

When running the following PHP- Code:

$order = commerce_order_load(1);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$profileid = $order_wrapper->commerce_customer_billing;
drupal_set_message($profileid);
pcambra’s picture

Have you tried $profileid = $order_wrapper->commerce_customer_billing->value();?

Ogredude’s picture

Status: Closed (fixed) » Active

I'm having the same issue.

Note that this error happens ONLY within a Simpletest test case, and ONLY when the Rule in question has a "page redirect" action on it.

With the page redirect in place, I can have the rule fire and everything behaves properly. When Simpletest runs, it fails the redirect assertion, and the verbatim includes this error message.

When I remove the page redirect, the error goes away (but of course the redirect assertion still fails)

Using the 7.x-2.x-dev version of Rules and 7.x-1.x-dev version of Entity API.

Fatal error: Call to undefined function entity_get_property_info() in /Users/ogredude/Sites/myproj.dev/sites/all/modules/entity/includes/entity.wrapper.inc on line 595

Call Stack:
    0.0002     634504   1. {main}() /Users/ogredude/Sites/myproj.dev/index.php:0
    0.0040    1403592   2. drupal_bootstrap() /Users/ogredude/Sites/myproj.dev/index.php:20
    0.0045    1416280   3. _drupal_bootstrap_page_cache() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:2098
    0.0051    1539576   4. drupal_bootstrap() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:2226
    0.0079    2215856   5. _drupal_bootstrap_variables() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:2106
    0.0082    2265440   6. variable_initialize() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:2328
    0.0157    3028016   7. array_map() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:921
    0.0208    4214688   8. EntityDrupalWrapper->__wakeup() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:0
    0.0208    4214688   9. EntityDrupalWrapper->setUp() /Users/ogredude/Sites/myproj.dev/sites/all/modules/entity/includes/entity.wrapper.inc:880
fago’s picture

Status: Active » Fixed

> 0.0082 2265440 6. variable_initialize() /Users/ogredude/Sites/myproj.dev/includes/bootstrap.inc:2328

You've somehow stored a drupal wrapper in your variables what is the cause of this. Please try updating rules to the latest dev version, and re-open for rules if that doesn't help.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mojzis’s picture

Priority: Major » Normal
Status: Closed (fixed) » Active

I am afraid this still is a problem, i just happened to run in a similar situation :
in a form_submit i created an entity, wrapped it and assigned some values to it.
then i did dpm($entity).
Since the form in question is set to redirect , on the next page i ended up with a
Fatal error: Call to undefined function entity_get_property_info()

the only way was to truncate table sessions (otherwise i was getting this on every page while logged as this user)

its probably stupid to dpm entity before redirect (i dont understand if it should work or not) , but the outcome was rather painful :).

I understand there is quite a few modules connected in this and dont know if this is the right queue, but i think it should be better to solve it ?

thanks anyway, entities are great fun :)

modules involved :
entity 7.x-1.0-rc1+46-dev
eck 7.x-2.0-alpha1+23-dev
devel 7.x-1.2

JurriaanRoelofs’s picture

I had the same thing as mojzis, getting fatal error on every page. If he didn't tell about the session table trick I would probably be at loss.
Trouble was started by dsm() on a wrapped order in hook_commerce_checkout_complete

kenorb’s picture

The same here.
This error happened when writing the test with Simpletest.

kenorb’s picture

See the attachment for error with backtrace.

I'm not sure which module/code written Entity Wrapper into cache, not mine.

In my case this happens somewhere between the following code using Simpletest test:

...
    $this->drupalPost(NULL, $edit, t('Continue'));
    $this->assertText(t('Review'), t('The page is: Review'));
    $this->drupalPost(NULL, $edit, t('Finish'));

when testing multipage CTools form.

jeremymcminn’s picture

I am getting the same error
PHP Fatal error: Call to undefined function entity_get_property_info() in /var/www/vhosts/verdureapp.com/httpdocs/sites/all/modules/entity/includes/entity.wrapper.inc on line 596

This occurred when I created a new domain (Domain Access) and user through a rules based on a new node creation. I have deleted all nodes, domains and user via PHPMyadmin but still cant seem to login back into my site, that is the error 500 i get. I can view any page as long as I am not logged in.

Any help to get back into my site would be appreciated!!!

mojzis’s picture

@jonnyfiasco : truncate table sessions

jeremymcminn’s picture

Yes I had already tried that, emptied cache tables, sessions, cleared my browser. Nothing was working so I ended up restoring a backup.

elnico’s picture

Had the same problem and as #9 said I had stored a drupal wrapper into the variables table. I just cleared the variable and worked again.

j0rd’s picture

Same problem.

I ran into mine after saving an entity in a custom form. Something was most likely not set correctly, and then either rules or the rules which create my messages are messed up.

Had to log out, then log back in to solve the problem.

Could also be due to a dpm.

jamix’s picture

In my case, the cause of the problem was also an instance of the EntityDrupalWrapper class serialized in the variable database table. Here are the SQL commands I used to find the offending variable and remove it:

mysql> SELECT name FROM variable WHERE value like '%EntityDrupalWrapper%';
+-----------------------------+
| name                        |
+-----------------------------+
| drupal_test_email_collector |
+-----------------------------+
1 row in set (0.01 sec)

mysql> DELETE FROM variable WHERE name = 'drupal_test_email_collector';
Query OK, 1 row affected (0.00 sec)

My site is now back up.

jdleonard’s picture

drupal_test_email_collector was the culprit for me too. It's used by the TestingMailSystem that ships with Drupal core. For me, it looks like something got serialized there as part of using the Message (or Message Notify) modules. Clearing that variable and setting the mail_system variable to something other than TestingMailSystem solved the problem and kept it from coming back.

jdleonard’s picture

Issue summary: View changes

fixing end tag

vijaycs85’s picture

This issue definitely present and occurring for certain situation. here is my error trace.

Fatal error: Call to undefined function entity_get_property_info() in /htdocs/profiles/myprofile/modules/contrib/entity/includes/entity.wrapper.inc on line 595

Call Stack:
    0.0001     679504   1. {main}() /htdocs/index.php:0
    0.0021     770080   2. drupal_bootstrap() /htdocs/index.php:20
    0.0279    3074632   3. drupal_session_initialize() /htdocs/includes/bootstrap.inc:2199
    0.0280    3075320   4. drupal_session_start() //htdocs/includes/session.inc:251
    0.0280    3075416   5. session_start() /htdocs/includes/session.inc:287
    0.0302    3309872   6. EntityDrupalWrapper->__wakeup() /htdocs/includes/session.inc:287
    0.0302    3309872   7. EntityDrupalWrapper->setUp() /htdocs/profiles/myprofile/modules/contrib/entity/includes/entity.wrapper.inc:877


rjacobs’s picture

Issue summary: View changes

I'm thankful for this thread, as without it we would have burned many hours on this very very non-intuitive issue. The root cause for us was also the drupal_test_email_collector variable. That variable's value did not contain the specific string referenced in #21 ("EntityDrupalWrapper"), but clearing it still resolved this problem immediately. I suppose this means that the TestingMailSystem class is somehow incompatible with entity-based message data that we are processing (via message_notify and message_subscribe modules). I'm wondering if this means a specific issue needs to be raised elsewhere, such are core? Honestly, I've not yet wrapped my head around all the specifics of how this problem is being triggered, but it will be nice to ensure it cannot resurface.

guy_schneerson’s picture

Had the same problem on a site and got the error on every page on the site.
#21 didn't work for me (no records returned)
I ended up adding the following lines of code just above the call to the entity_get_property_info in entity.wrapper.inc protected function setUp() (595 on my version).
This allowed me to refresh the page, once I got the page back I removed the extra lines and the problem disappeared

<?php
    if (!function_exists ( 'entity_get_property_info' )) {
      return;
    }
?>
dkane’s picture

Thanks Jamix! You saved my bacon. I have learned my lesson, I will no longer use the drupal testing mail system!

arthur_drupal’s picture

Thanks Jamix ! You saved my problem to ! In my case, this happened when i used variale_set instead of variable_set so it caused a fatal error (that is normal) but when i corrected to variable_set, i had still the 500, "Call to undefined function".

I think this is caused by Rules only because this happened when i install the module and when a 500 occured during a Rules processing.

texas-bronius’s picture

Status: Active » Closed (won't fix)

Good leads here, folks, thanks! My experience appears to have come from a session-stored custom object whose properties I changed while developing. At least that's what I suspect.. Anyhow, manually deleting the test user's session from sessions (drush sqlq "truncate sessions;") seems to have done the trick.

@jamix' comment explained why variables (and $_SESSION variables) would be affected by this for whatever root cause: the Entity API relies on its __sleep() and __wake() magic methods which are invoked at serialize()/unserialize() (which are used when Drupal stores objects in the db for variables and sessions).

I don't entirely get why the cause, but I feel good about why the fix :) And in my case, at least, it was temporary, due entirely to session-stored entity-wrapping custom objects stored in $_SESSION and nothing to do with Entity API or testing.

texas-bronius’s picture

Status: Closed (won't fix) » Active
FileSize
83.76 KB

I was a bit hasty in closing the issue having seen two independent cases, each with its own workaround and the linked issue also marked as closed. However, it's fitting enough to consider that it might be a bug that waking from session breaks in this manner:
When an object having:

  function __construct($run_as_uid = NULL) {
    $this->wizard_user = entity_metadata_wrapper('user', $run_as_uid, array('type' => 'user'));
    ..

and the entiy_metadata_wrapper $data variable ($run_as_uid here) is NULL, and an instance is stored in a $_SESSION variable, then on all subsequent page loads (when bootstrap conjures up session variables as part of the things it does), Entity API::__wakeup() -> EntityDrupalWrapper::setUp() -> entity_get_property_info() fails. Normally, passing a NULL is not an issue, and the thing just loads an empty entity metadata wrapper.

Screenshot of error stack trace

The fix, in this case, turns out to be to test for NULL for the variable:

  function __construct($run_as_uid = NULL) {
    $this->wizard_user = $run_as_uid ? entity_metadata_wrapper('user', $run_as_uid, array('type' => 'user')) : NULL;
    ..

and I first manually delete the borked session from the sessions table in order to successfully complete bootstrap.

Hope this helps.. Maybe it's not a bug but something on my end..?

a.kovrigin’s picture

Thanks texas-bronius, «truncate sessions» from #28 worked for me!

alex.skrypnyk’s picture

For those of us who encountered this problem while running Simpletest tests (or any other kind of tests that rely on mail collector) for email sent via Rules: this problem is related to the fact that Rules populates $message['params']['context']['action'] and $message['params']['context']['state'] with objects that trigger serialization after being stored to the DB (into mail collector variable) and then read from the database by variable_get().

The solution is to unset these parameters in your hook_mail_alter(), but only when tests are running.

/**
 * Implements hook_mail_alter().
 */
function YOUMODULE_mail_alter(&$message) {
  // Unset 'complex' context values when using test mail system. 
  $mail_system = mailsystem_get();
  if ($mail_system['default-system'] == 'TestingMailSystem') {
    unset($message['params']['context']['action']);
    unset($message['params']['context']['state']);
  }
}
Oliver Huynh’s picture

8 years passed but this mystery bug is still happening. I've used the latest versions of entity and rules. I also tried using latest dev versions of these modules but the issue is still.

This is just a dirty fix but this will solve the issue right away.

Status: Needs review » Needs work

The last submitted patch, 32: mystery.undefined.entity.patch, failed testing. View results

Oliver Huynh’s picture

Status: Needs review » Needs work

The last submitted patch, 34: mystery.undefined.entity.patch, failed testing. View results

kerasai’s picture

Similar to #31, for emails sent by via messages unset the following data to avoid serializing these breaking entities into the test email system collector variable.


unset($message["params"]["message_entity"]);

mirondi’s picture

ravi.shankar’s picture

Status: Needs work » Needs review