when testing a new module I got a lot of messages sent by "drupal_set_message". But suddenly it stopped showing messages. To solve this I tried to
* wipe out the browser cache
* put the line "drupal_get_messages(NULL,TRUE);" in front of the function in question
* reboot the server
* reinstall Drupal from a backup

all with no avail.
Everything else is working fine.
Does somebody has a hint for me?

Regards

Comments

WorldFallz’s picture

it not really possible to help unless you actually post your drupal_set_message code...

schildi’s picture

ok, here is one of the fragments that did it's work previously:

  $max = $dhl_values['max'];
  if ( mb_strlen($dhl_matrix[$dhl_l][$ndx]) > $max ) {
      drupal_set_message(   t('Line %farina_l purged (%dhl_name too long, max=%max).',
                                            array('%farina_l' => $farina_l, '%dhl_name' => $dhl_name, '%max' => $max)
                                    ),'error');
     unset($dhl_matrix[$dhl_l]);
     ...

The code is executed, but I don't get a message

WorldFallz’s picture

i don't see anything obvious-- did you double-check your conditional by outputting it via print_r or something? Also might be worth trying drupal_strlen.

schildi’s picture

OK, there are two location in the sources where "drupal_set_message" doesn't display. I just double-checked the second one and inserted a watchdog-line at top of the if-block:

          // ungültige Zeilen entfernen
  foreach ($dhl_csv_format as $dhl_name => $dhl_values) {
      $ndx = $dhl_values['index'];
      if ($dhl_values['pflicht']) {
          if (!$dhl_matrix[$dhl_l][$ndx]) {
watchdog('error',"$dhl_l: purge line");
              // form_set_error($form, t("Line $farina_l purged (missing $dhl_name)"));
              drupal_set_message( t('Line %farina_l purged (missing %dhl_name).',
                  array('%farina_l' => $farina_l, '%dhl_name' => $dhl_name)),'error');
              unset($dhl_matrix[$dhl_l]);

No output on screen, but in the log I see the messages.

Diogenes’s picture

I was also having this problem with simple calls like drupal_set_message("Hello world" ) which I often use just to see if a hook is being called. Someone suggested trying the watchdog function and checking the log files, which I did.

The message did show up in the dblog report, along with the error that logo.png was missing. I was also doing some theme testing at the time and had enabled the site logo option for the theme even though the logo.png file did not exist.

Before I had corrected the missing logo.png condition, the dsm message would NEVER appear using one theme and would only appear occasionally using Bartik (on D7). After correcting this problem the dsm message appears on every page refresh as expected.

So it appears that "page not found" errors may be impacting the dsm message queue. Check your log files and correct all page not found errors (at the very least)