Hi,i have this problem when i am at Home » Administration » Structure » Heartbeat » Heartbeat templates. The code at line 3140 is $element['#checked'] = ((string) $value === (string) $return_value); any idea?

Comments

salomos’s picture

I have the same error but I am not using Heartbeat. I am using Drupal Commerce Kickstart. Does anyone know how to fix this problem?

bblancha’s picture

I have a similar error with core 7.18 and content access.
I get
"Array to string conversion in form_process_checkbox() (line 3144..."

error whenever I try to set access permissions say on the Article content type. I have a generic configuration, no new content types or customization. Just core 7.18 with a list of modules installed. No content was added yet.

Forgot to mention as I think it may be the problem. My host has moved to PHP 5.4.9. Could this be a problem? I cannot revert to an earlier version of PHP

ramsunvtech’s picture

Issue tags: +Drupal

Guys,

I think problem with return value defined as array in your custom module. I checked out the Drupal 7 core code in the "includes\form.inc" file (http://api.drupal.org/api/drupal/includes!form.inc/7)

In line number: 3126 - Its a value which we set for the element
$value = $element['#value'];
For your Reference: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...

In line number: 3127 - Its a value element should return when selected
$return_value = $element['#return_value'];
For your Reference: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...

This will go to else condition if the "$element['#value']" is string and not a Boolean also not a zero. Now, i will explain why u got this error because in your case you got the return value as array. as per the line number:3144, the return value has been converted to string
line number:3144 - $element['#checked'] = ((string) $value === (string) $return_value);

Happy to receive your replies.

Warm Regards,
Venkat

jamescarvin’s picture

Everything you have stated, Venkat, is what is written on the corresponding lines. How should the line read so that it does not produce the error in line 3144?

rorevaz’s picture

Issue summary: View changes

Once that the necessary result is 0 or 1 (an integer number anyway) I have changed the type of string to int as follow.
$element['#checked'] = ((string) $value === (string) $return_value); changed to
to $element['#checked'] = ((int) $value === (int) $return_value);
and the problem was solved.

Kebz’s picture

I get this notice below whenever I click on the "add" button under the Heartbeat Templates and Heartbeat Plugins.

Notice: Array to string conversion in form_process_checkbox() (line 3217 of /includes/form.inc).

Arunah’s picture

Thx rorevaz, works for me.

marinex’s picture

Hi, this issue is because in the function pluginAttachmentForm should be:

'#default_value' => isset($form_values['settings'][$this->settings['plugin_name']]['activitycomments_node']) ? $form_values['settings'][$this->settings['plugin_name']]['activitycomments_node'] : false,

not

'#default_value' => isset($form_values['settings'][$this->settings['plugin_name']]['activitycomments_node']) ? $form_values['settings'][$this->settings['plugin_name']]['activitycomments_node'] : array(),

Notice: false instead of the array()

You do not hack core!!!

Marinex

apaderno’s picture

Issue tags: -Drupal