[development] Strange error on drupal_set_message calls in hook enable
Daniel Caillibaud
ml at lairdutemps.org
Mon May 11 09:28:23 UTC 2009
Hi,
In hook enable (mymodule.install file), drupal_set_message throws a fatal error, but only if called in a if { bloc }.
Strange isn't it ?
This is the code, tested with php 5.2.6
define('DEBUG', TRUE);
function mytestmodule_enable() {
// this line throws Fatal error: Call to undefined function drupal_set_message()
// if (function_exists('drupal_set_message')) { drupal_set_message("fct mytestmodule_enable"); }
// but this one don't (if previous line disabled)
drupal_set_message("fct mytestmodule_enable");
// and this one also throws the fatal error
//if (DEBUG) { drupal_set_message("fct mytestmodule_enable"); }
}
--
Daniel
More information about the development
mailing list