Download & Extend

D7: Error Message When Viewing a Node's "Access Control" tab (ACL with Content Access module)

Project:Content Access
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hey everyone,

I just tried out the latest ACL 7.x-1.x-dev snapshot with the Content Access 7.x version found at http://drupal.org/node/690610 (comment #9). When I tried to view a node's access control page (the "Access control" tab when viewing a node), I received the following error message (and the page was unaccessible):

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'grant_update' at row 1: INSERT INTO {acl_node} (acl_id, nid, grant_view, grant_update, grant_delete, priority) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => 0 ) in acl_node_add_acl() (line 96 of /home/sandboxes/sandbox10/public_html/sites/all/modules/contrib/acl/acl.module).

I can confirm that this error message only occurs with the ACL module enabled. If the ACL module isn't enabled, I'm able to successfully view the node's "Access Control" page.

Any ideas about the meaning of this error and how to fix it?

Thanks,
Ben

Comments

#1

Title:Error Message When Viewing a Node's "Access Control" tab (ACL with Content Access module)» D7: Error Message When Viewing a Node's "Access Control" tab (ACL with Content Access module)
Project:ACL» Content Access
Version:7.x-1.x-dev» 6.x-1.x-dev

How is acl_node_add_acl() called from CA? It seems it's passed NULL rather than 0.

It's too bad atchijov zips his files — I'd look inside if he didn't...

#2

Hey salvis,

I took a loot at the content_access.admin.inc file contained in atchijov's zip file and here's the code I found:

  if (module_exists('acl')) {
    // This is disabled when there is no node passed.
    $form['acl'] = array(
      '#type' => 'fieldset',
      '#title' => t('User access control lists'),
      '#description' => t('These settings allow you to grant access to specific users.'),
      '#collapsible' => TRUE,
      '#tree' => TRUE,
    );
    foreach (array('view', 'update', 'delete') as $op) {
      $acl_id = content_access_get_acl_id($node, $op);
      acl_node_add_acl($node->nid, $acl_id, $op == 'view', $op == 'update', $op == 'delete', content_access_get_settings('priority', $node->type));
      $form['acl'][$op] = acl_edit_form($acl_id, t('Grant !op access', array('!op' => $op)));
      $form['acl'][$op]['#collapsed'] = !isset($_POST['acl_'. $acl_id]) && !unserialize($form['acl'][$op]['user_list']['#default_value']);
    }
  }

Any thoughts on what needs to be fixed?

In case you want to look at the entire content_access.admin.inc file (or the content_access.module file), I have attached them to this comment. I had to switch their extension to .txt so I could upload them.

Thanks for your help with this!

--Ben

AttachmentSizeStatusTest resultOperations
content_access.admin_.inc_.txt17.32 KBIgnored: Check issue status.NoneNone
content_access.module.txt17.27 KBIgnored: Check issue status.NoneNone

#3

Hmm, then it seems to be FALSE rather than NULL that is not accepted.

Please try

      acl_node_add_acl($node->nid, $acl_id, (int) ($op == 'view'), (int) ($op == 'update'), (int) ($op == 'delete'), content_access_get_settings('priority', $node->type));

The grants should be ints (i.e. 0 or 1). If it turns out that this change fixes the problem, then I'll add the casts in ACL to make it more robust.

#4

Hey salvis,

I made the change you suggested in #3, but I got a white screen of death. Looking in the error logs, this was the new error message:

PHP Fatal error: Call to undefined function db_result() in /home/sandboxes/sandbox10/public_html/sites/all/modules/contrib/acl/acl.admin.inc on line 16, referer: http://sandbox10.testsite.org/node/2

Any ideas?

Thanks,
Ben

#5

Ah, this means we're making progress — you got past the error in the OP! :-)

Please reopen #798106: Updated queries for drupal 7 which was supposed to remove all calls to db_result(), and report the error message there.

#6

Hey salvis,

As you suggested, I just cross-posted the error message in #4 at http://drupal.org/node/798106. See you over in that issue thread...

--Ben

#7

Status:active» closed (fixed)

I think this issue is fixed with the latest ACL and Content Access, if not reopen it please.

nobody click here