After installation, the recent log messages fill up on every page hit with a PHP warning that headers cannot be modified as they are already sent.

The error occurs because of line 39 in the .module file:

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

Upon a quick test, uncommenting the line does not affect this module, but removes the error messages.

Comments

jbafford’s picture

It seems to me that there are two possible fixes to this issue:

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL, false);
Which would most closely preserve the existing behavior but use the drupal_bootstrap() api correctly. (drupal_bootstrap is reentrant, and the comments indicate that false should be passed as the second parameter when drupal_bootstrap() is being re-entered, as it is in this case.)

drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, false);
Since it appears that statistics_granularity only needs access to the database (DRUPAL_BOOTSTRAP_DATABASE), and to variables so it can read its config/update the database, this would be more precise, and save the additional overhead of proceeding through the rest of the drupal bootstrap process.

I've tested both, and both seem to work for me.

jbafford’s picture

Issue summary: View changes

Cannot modify header information - headers already sent