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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

salvis’s picture

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...

BenK’s picture

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

salvis’s picture

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.

BenK’s picture

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

salvis’s picture

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.

BenK’s picture

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

good_man’s picture

Status: Active » Closed (fixed)

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

Bojhan’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (fixed) » Needs work

I'm getting this error. Seems like it is still occuring

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '318-16-acl' for key 'PRIMARY': INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) 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), (:db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 318 [:db_insert_placeholder_1] => acl [:db_insert_placeholder_2] => 16 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 318 [:db_insert_placeholder_7] => content_access_rid [:db_insert_placeholder_8] => 3 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 0 ) in node_access_write_grants() (line 3548 of node/node.module).

Small note, I get this when I want to set the user value of a user reference field. Frank, I get this with all of my fields (I am using set_data_value).

The way to reproduce this, is to use the rules and set a data value - you will notice this throws a integrity constraint violation.

Bojhan’s picture

salvis’s picture

@Bojhan:
Put a breakpoint into node_access_write_grants() and check where it's being called from. It should only be called by core (from node_access_acquire_grants() if memory serves right), NOT by any contrib.

I get this when I want to set the user value of a user reference field.

This does not seem to correspond to the subject of this thread.

gisle’s picture

Status: Needs work » Closed (outdated)

This issue has not received any updates in the previous 6 years. If you believe it to still be relevant, you are encouraged to reopen the issue and update it.