Hi. I have a form where I call field_attach_form. Devel wont display form_state from _valdiate or _submit of such form. If I comment out the field_attach_form function everything is ok and devel will display form_state. Any ideas ?

Comments

salvis’s picture

Title: Devel wont dispaly form_state of form with field_attach_form » Devel wont display form_state of form with field_attach_form

No ideas from me, but I'm interested in getting a patch if you look into it...

Anonymous’s picture

I was able to work around this problem by:

function someform_submit($form, &$form_state) {
  unset($_SESSION['state']);
  $_SESSION['state'] = $form_state;
  dsm($_SESSION['state']);
}
salvis’s picture

What is wrong with

function someform_submit($form, &$form_state) {
  dsm($form_state);
}

?

I don't know what exactly needs to be in $_SESSION['state'], but it probably ought to be preserved.

bleen’s picture

I have seen issues where this happens when the data in form state is too large for the $_SESSION var to handle.

itarato’s picture

I was testing this issue and managed to reproduce the problem. I was using dpm() dumping the form_state variables and indeed it did not appear.
I was checking out the code and it turned out MySQL is the bottleneck, it simply cannot save that large data. (My dpm() with the form status generated a 4.5M large text blob. _drupal_session_write() wants to write it into the db.)

I think it's a normal behavior, as a solution the my.cnf can be adjusted by increasing the max_allowed_packet size:

[mysqld]
max_allowed_packet = 8M

bleen’s picture

Personally I would love to see a message saying "variable x could not be displayed because it was too large"

Something to tell me in not crazy.

salvis’s picture

Currently we delegate dpm() to drupal_set_message(). I'm not aware of any way to detect that it has failed.

There's hope in #1853112: Replacement for Krumo?.

moshe weitzman’s picture

Status: Active » Closed (works as designed)

I don't think it is prudent or reasonable for devel to check the mysql settings and warn if it can't insert a particular debug message. Drupal doesn't do that on its inserts.

salvis’s picture

BTW, in these situations I try kpr() and it usually works.