I need to define with Strongarm a variable that is multidimentional, e.g.:

function mymodule_strongarm() {
  $variables = array(
    'my_var' => array(
      0 => array(
        'my_key1' => "foo",
        'my_key2' => "bar",
      ),
    ),
  );
  ...

When I open Strongarm page (admin/config/development/strongarm), I get this error: Notice: Array to string conversion in _strongarm_readable() (line 116 of <snap>/sites/all/modules/strongarm/strongarm.admin.inc).

It seems that Strongarm presumes that all variables of type Array are only one dimentional arrays, therefore implode() function that is called within _strongarm_readable() throws this error if variable of type Array has elements that are arrays.

The patch that is attached solves this bug by checking whether variable of type Array has elements of type Array, and allows implode() function to be called only if no elements of type Array are found within the variable.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daften’s picture

Issue summary: View changes

I'm experiencing the same problem

BillyTom’s picture

Version: 7.x-2.x-dev » 7.x-2.0
FileSize
726 bytes

I have the same issue in the current version. The patch that maijs provided fixed the problem for me.

I have renamed the patch according to the patch guideline

joelpittet’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
Status: Active » Needs review

Forgot to put this up for review.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Not sure if this is the right approach but it fixes all those notices so thank you.

+++ b/strongarm.admin.inc
@@ -108,8 +108,11 @@ function _strongarm_readable($var) {
+    // Check if $var array has elements of type Array. If there are, do not implode elements.

Comment needs to wrap at 80 chars. Can be fixed on commit.