When drupalforfirebug module (drupalforfirebug 7.x-1.x-dev 2010-07-10) is enabled in the latest drupal core release (Drupal 7.0-beta1) it causes a fatal PHP error (and "white screen of death") on the permissions page (/admin/people/permissions).

This is because it provides the wrong type of array in the drupalforfirebug_permission() implimnetation of hook_permission()

Here's the function as it exists :

/**
* Implementation of hook_permission()
*/
function drupalforfirebug_permission() {
  return array('Access Firebug Debug', 'Execute Firebug PHP');
}

Here is the corrected function:

/**
* Implementation of hook_permission()
*/
function drupalforfirebug_permission() {
  return array(
	'access firebug debug' => array('title'=>'Access Firebug Debug'),
	'execute fierbug php' => array('title' => 'Execute Firebug PHP'),
	);
}

A diff of these changes is included bellow. Forgive me if it is not in the right format. I'm still new to patching.

Comments

manimejia’s picture

StatusFileSize
new682 bytes
vikingew’s picture

StatusFileSize
new836 bytes

I think the correct code should be something like this:

/**
* Implementation of hook_permission()
*/
function drupalforfirebug_permission() {
  return array(
    'access firebug debug' => array(
      'title' => t('Access Firebug Debug'),
      'description' => t('TODO Add a description for Access Firebug Debug'),
      ),
    'execute firebug php' => array(
      'title' => t('Execute Firebug PHP'),
      'description' => t('TODO Add a description for Execute Firebug PHP'),
      ),
    );
}

it still doesn't solve a WSOD problem with accessing Modules page after enabling this module. As is Modules are totally unaccessable but I'm not sure if it's the same issue though. I will role back my db and redo it and see if I can catch what went wrong.

vikingew’s picture

Not that I really want to sound negative, but... running this module through coder flags about 60 breakages of drupal coding standards, which in itself is a bad sign pointing to a high risk for sloppy coding may have lead to the current state where enabling the module results in a WSOD error.

One such thing that coder doesn't catch is in drupalforfirebug.install where

function drupalforfirebug_update_1() {
should be
function drupalforfirebug_update_7000() {
or possibly
function drupalforfirebug_update_7001() {

but I think the first one (7000) is correct.

Again, appreciating the work going in to this important module, but it's still no excuse for and it's not hard to understand that coding standards are there for a reason, and shoudn't be neglected.

vikingew’s picture

StatusFileSize
new4.84 KB

Here is a more comprehensive patch that also fixes the WSOD problem, it appears to have been caused by weight set to 100000 and not -100000 as in the preprocessor module, or if it was the bug in preprocessor.info file which had .info assigned to files[] instead of .module, I don't know as I fixed both at the same time. I haven't bothered about the coding standard issues as I like to leave that to the maintainer ;-)

btw, the weight bug is in D6 version as well

Displayed here for a visual but attached further down as well, and don't bother about the revision number, it's because I import and keep all my stuff in subversion.

Index: sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.info
===================================================================
--- sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.info	(revision 1095)
+++ sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.info	(working copy)
@@ -2,7 +2,7 @@
 description = A helper extension for the Drupal for Firebug Firefox extension to do preprocessing of forms
 package = Development
 core = 7.x
-files[] = drupalforfirebug_preprocess.info
+files[] = drupalforfirebug_preprocess.module
 
 ; Information added by drupal.org packaging script on 2010-07-11
 version = "7.x-1.x-dev"
Index: sites/all/modules/drupalforfirebug/drupalforfirebug.module
===================================================================
--- sites/all/modules/drupalforfirebug/drupalforfirebug.module	(revision 1095)
+++ sites/all/modules/drupalforfirebug/drupalforfirebug.module	(working copy)
@@ -46,7 +46,7 @@
 */
 function drupalforfirebug_node_process(&$node, $op) {
   global $dfp_runtime;
-  if (!user_access('Access Firebug Debug')) {
+  if (!user_access('access firebug debug')) {
     return;
   }
   $nid = (isset($node->nid)) ? $node->nid : '*'. t('NEW') . '*';
@@ -60,7 +60,7 @@
 */
 function drupalforfirebug_views_pre_view(&$view, &$display_id) {
   global $dfp_runtime;
-  if (!user_access('Access Firebug Debug')) {
+  if (!user_access('access firebug debug')) {
     return;
   }
   $data = drupalforfirebug_array_compare((array) $dfp_runtime['drupalforfirebug_views']['original'][$view->name], (array) $view);
@@ -83,7 +83,7 @@
 */
 function drupalforfirebug_form_alter(&$form, &$form_state, $form_id) {
   global $dfp_runtime;
-  if (!user_access('Access Firebug Debug')) {
+  if (!user_access('access firebug debug')) {
     return;
   }
   if ($form_id != 'drupalforfirebug_execute_form') {
@@ -112,6 +112,6 @@
 */
 function drupalforfirebug_user_processing($op, &$account) {
   global $dfp_runtime;
-  if (!user_access('Access Firebug Debug')) {
+  if (!user_access('access firebug debug')) {
     return;
   }
@@ -210,7 +210,7 @@
 
 function drupalforfirebug_get_php_exec($code = NULL) {
   $output = '<fieldset>';
-  if (!user_access('Execute Firebug PHP')) {
+  if (!user_access('execute firebug php')) {
     $output .= '<legend>' . t('Execute Firebug PHP') . '</legend>';
     $output .= t('You do not have the proper permissions to use this functionality.');
     $output .= '</fieldset>';
@@ -261,7 +261,7 @@
 * Output Function to Return Hidden Div Containers in Footer
 */
 function drupalforfirebug_exit() {
-  if (!user_access('Access Firebug Debug')) {
+  if (!user_access('access firebug debug')) {
     return;
   }
   $output = '<div style="display: none" id="drupalforfirebug_general">';
@@ -311,7 +311,16 @@
 * Implementation of hook_permission()
 */
 function drupalforfirebug_permission() {
-  return array('Access Firebug Debug', 'Execute Firebug PHP');
+  return array(
+    'access firebug debug' => array(
+      'title' => t('Access Firebug Debug'),
+      'description' => t('TODO Add a description for Access Firebug Debug'),
+      ),
+    'execute firebug php' => array(
+      'title' => t('Execute Firebug PHP'),
+      'description' => t('TODO Add a description for Execute Firebug PHP'),
+      ),
+    );
 }
 
 /**
Index: sites/all/modules/drupalforfirebug/drupalforfirebug.install
===================================================================
--- sites/all/modules/drupalforfirebug/drupalforfirebug.install	(revision 1095)
+++ sites/all/modules/drupalforfirebug/drupalforfirebug.install	(working copy)
@@ -4,11 +4,16 @@
 * Implementation of hook_instal()
 */
 function drupalforfirebug_install() {
-  db_query("UPDATE {system} SET weight = 100000 WHERE name = 'drupalforfirebug'");
+  db_update('system')
+    ->fields(array('weight' => -100000))
+    ->condition('name', 'drupalforfirebug')
+    ->execute();
 }
 
-function drupalforfirebug_update_1() {
-  $items = array();
-  $items[] = update_sql("UPDATE {system} SET weight = 100000 WHERE name = 'drupalforfirebug'");
-  return $items;
+function drupalforfirebug_update_7000() {
+  db_update('system')
+    ->fields(array('weight' => -100000))
+    ->condition('name', 'drupalforfirebug')
+    ->execute();
+
 }
Index: sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.install
===================================================================
--- sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.install	(revision 1095)
+++ sites/all/modules/drupalforfirebug/drupalforfirebug_preprocess.install	(working copy)
@@ -4,5 +4,8 @@
 * Implementation of hook_install()
 */
 function drupalforfirebug_preprocess_install() {
-  db_query("UPDATE {system} SET weight = -100000 WHERE name = 'drupalforfirebug_preprocess'");
+  db_update('system')
+    ->fields(array('weight' => -100000))
+    ->condition('name', 'drupalforfirebug_preprocess')
+    ->execute();
 }
populist’s picture

The permission issue was fixed in version 1.1 in this issue - http://drupal.org/node/1017202

populist’s picture

Status: Needs review » Fixed

And the installation issues were fixed in the last commit (ac0c5f4..8a2bf68) and should be ready for action soon!

Status: Fixed » Closed (fixed)

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