PHP Warning: implode(): Invalid arguments passed
ClosedPublic

Authored by vanmeeuwen on Jul 3 2017, 11:08 AM.

Details

Summary

A first attempt to fix the following warning:

PHP Warning:  implode(): Invalid arguments passed in /usr/share/kolab-syncroton/lib/kolab_sync_data.php on line 752
Test Plan

None

Diff Detail

Repository
rS syncroton
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
vanmeeuwen created this revision.Jul 3 2017, 11:08 AM
machniak requested changes to this revision.Jul 3 2017, 11:22 AM

This way you can end up with true. I'd rather make sure $relation['members'] is an array. e.g.

'members' => implode("\n", (array) $relation['members']),
This revision now requires changes to proceed.Jul 3 2017, 11:22 AM
vanmeeuwen updated this revision to Diff 1061.Jul 3 2017, 11:49 AM
  • Ensure $relation['members'] is an array
In D455#5366, @machniak wrote:

This way you can end up with true. I'd rather make sure $relation['members'] is an array. e.g.

'members' => implode("\n", (array) $relation['members']),

If $relation['members'] is a string though, converting it to an array would void the validity, right?

I thought that

'members' => empty($relation['members']) ?: implode("\n", $relation['members']),

would end up with 'members' => null, but I see your point.

machniak accepted this revision.Jul 3 2017, 11:54 AM
This revision is now accepted and ready to land.Jul 3 2017, 11:54 AM
This revision was automatically updated to reflect the committed changes.