When I run the 'Hooks' test on PHP 5.4.6 I get the following notice:

Notice: Array to string conversion in ds_field_attach_view_alter() (line 811 of .../sites/all/modules/contrib/ds/ds.module).

PHP 5.4 always generates a notice when converting an array to a string. This is done because after conversion the string will contain the word 'Array' which usually is not something a developer wants to continue working with.

The test which throws this notice is intentionally feeding invalid data to ds_field_attach_view_alter(). The error message can be suppressed by changing line 811:

-    if (!empty($field_value) || (string) $field_value === '0') {
+    if (!empty($field_value) || (!is_array($field_value) && (string) $field_value === '0')) {

But this would probably not be the right approach, as this would actually be a workaround to avoid a test from throwing a notice. The purpose of the notice is to make debugging easier when developers unintentionally pass in an array instead of a string. This should be kept in.

I suppose the right solution would be to simply remove the test case that passes in bad data.

Comments

pfrenssen’s picture

Status: Active » Needs review
StatusFileSize
new2.02 KB
swentel’s picture

Issue tags: +RC blocker

tagging (note, if you're here in munich, we're doing a sprint wednesdayafternoon - or remote is fine as well ;)

pfrenssen’s picture

I cancelled my trip to Munich because of a looming deadline on an important project, and I'm totally regretting it :-/
I'll never miss a Drupalcon again!!

swentel’s picture

Status: Needs review » Fixed

Makes sense, thanks!

swentel’s picture

Issue tags: -RC blocker

untagging

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.