hi there,

i'm trying to execute some custom php code after a form gets submitted. while trying to find the value of a form field, i used following code:

var_dump($form['acl']['view']['user_list']['#post']);

rules debugging says the code gets executed, but i dont get any output, not even a "null". if i change the code to:

var_dump($form['acl']['view']['user_list']);

i'll get this output (truncated):

array
  '#post' => 
    array
      'acl' => 
        array
          'view' => 
            array
              'user_list' => string 'a:2:{i:1;s:5:"chief";i:3;s:5:"benni";}' (length=38)

i'm trying to get the value of the field "user_list" after the form is submitted, but as soon as i use a fieldname with a hash in it, the code doesn't get executed. if there is another way to get the value or if there is a way to escape the hash, please let me know.

Comments

DieterWeb’s picture

Title: executing custom php code with a hash fails » weird behaviour while executing custom php code as an action (was:executing custom php code with a hash fails)
Component: Rules Core » Rules Engine

update: the hash doesnt seem to be the problem, it's something else. maybe the depth of the array. here is another test i've done:

first action with this custom php code:

var_dump($form_state['values']);

output (truncated again):

array
  'view' => 
    array
      1 => int 0
      2 => int 0
      3 => boolean true
      4 => int 0

now, next try with a deeper array level:

var_dump($form_state['values']['view']);

output:
nothing, no var_dump, no "null", just nothing.

i have absolutely no idea what the problem could be, so if anyone has any clue, please help.

DieterWeb’s picture

and to make it even more confusing, here is another test i just did:

first try, code:

$users = acl_get_uids(acl_get_id_by_name("content_access", "view_23"));
var_dump($users);

output:
again nothing

second try, code:

$users = acl_get_uids(acl_get_id_by_name("content_access", "view_23"));
var_dump($users);
var_dump($form);

output:

array
  1 => string '1' (length=1)
  3 => string '3' (length=1)

array
  'per_role' => 
    array
      '#type' => string 'fieldset' (length=8)
      '#title' => string 'Einstellungen für die Rollenbasierte Zugriffskontrolle' (length=55)
      '#collapsible' => boolean true
      ...

so, in the second example, it outputs both arrays, in the first example it outputs nothing. this is extremely strange.

fago’s picture

Category: bug » support
mitchell’s picture

Status: Active » Closed (fixed)

Closing older issues to make the issue queue easier to navigate. If you still need assistance, please try the latest versions, read through the documentation handbooks, and search for other other issues with relevant responses. This will more than likely give you an answer to your question, or you can always open another issue. Thanks.