After updating to 3.3 I am unable to make changes to the linkit profiles.
I get the error "Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2337"
when saving the settings.
Now i reverted to 3.2 and the config page is working.

Comments

anon’s picture

Make sure you run the update.php to update the database changes.

anon’s picture

Category: Bug report » Support request
Priority: Major » Normal
robbertnl’s picture

@#1 I did, but in the end was it my own PEBKAC. I assume i was confused somewhere with different servers.

robbertnl’s picture

Status: Active » Closed (works as designed)
robbertnl’s picture

Status: Closed (works as designed) » Active

Still experiencing issues, special when trying to disable the imce plugin (disabled because private files are not supported at the moment ) for linkit. Does sometimes generate the error from this issue

punch’s picture

After update to 3.3 I am get this warning when edit an existing profile:
Warning: Invalid argument supplied for foreach() i form_type_checkboxes_value() (linje 2337 af xxx/drupal/xxx/includes/form.inc).

and when I try to save:
An illegal choice has been detected. Please contact the site administrator.

knalstaaf’s picture

Title: Config page broken » Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value()
Version: 7.x-3.3 » 7.x-3.x-dev

Having the same error as described in #6.

Update.php is run, chaches are cleared. This also occurs in the current dev-version.

knalstaaf’s picture

StatusFileSize
new2.28 KB

I've added an export of my config it case it may be of any convenience when reproducing. It's the only Linkit-config I'm having.

knalstaaf’s picture

StatusFileSize
new2.16 KB

Sorry, that was the wrong one. The right one is attached to this post.

ashalan’s picture

It looks like the update hook

function linkit_update_7302() {
  require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'linkit') . '/plugins/linkit_search/file.class.php';
  $profiles = linkit_profile_load_all();
  foreach ($profiles as $profile) {
    if (isset($profile->data['entity:file'])) {
      $profile->data['entity:file'] = LINKIT_FILE_URL_TYPE_ENTITY;
      ctools_export_crud_save('linkit_profiles', $profile);
    }
  }
}

on this issue was trying to set the url-type under the entity:file array in the linkit_profiles table. However it replaced the entire entity:file array with a string rather than just the url-type. So attempting to save existing profiles flags errors as a result of that faulty data. Can someone confirm that this error is coming from that update?

chiebert’s picture

Re #10 - Yep, I'm just seeing this now myself. Was twigged to the fact when I noticed my media-related Feature was showing as overridden, after I undated to linkit-7.x-3.3. a drush features-diff showed exactly what you describe: the entity:file[] array has been clobbered. Any ideas how to get us back on track?

ashalan’s picture

Category: Support request » Bug report

Recategorizing this issue as a bug. Will try to upload a db fix today.

ashalan’s picture

StatusFileSize
new523 bytes

This patch should fix issues with saving profiles. It should also fix issues with patch tests failing on d.o

ashalan’s picture

Status: Active » Needs review
punch’s picture

The patch do not fix the problem described in #6

knalstaaf’s picture

Patch in #13 works for me. Thanks Ashalan.

eric_a’s picture

Status: Needs review » Needs work

Patch in #13 works for me. Thanks Ashalan.

That function linkit_update_7302() is in the 7.x-3.3 release and here to stay. Patch #13 will only do something if you patch the code and only then run the existing update function.
What is needed is a new update function to fix installations that have run the 7302 update.

ciss’s picture

Status: Needs work » Needs review
StatusFileSize
new723 bytes

New update hook and sanity checks.

ciss’s picture

ciss’s picture

Status: Needs review » Needs work

By the way, in our case the problem was likely caused by using an older feature export with a recent version of linkit. The above patch will only work if it has not been committed and the update hook hasn't been occupied by other updates yet.
The cleanup should probably go to something like features rebuild.

sylus’s picture

The patch works for me and I don't see the harm in keeping it as an update function for 7303. Why not commit this new update hook?

Something I am missing?

tenken’s picture

A client says they're getting "An illegal choice has been selected in the form. Please contact the site administrator". They have recently updated to LinkIt 3.4 installed.

The manually deleted the Profile and rebuilt it by hand in 3.4, this seems to have resolved the profile saving issue temporarily.

Why was 3.4 released without including the fix outlined in this thread (lack of testing?), or is this not a verified issue, wouldnt it affect most everyone who has run the 3.2 update?

anon’s picture

Well, that commited update hook will and have broken things for sure.

I don't know about profiles saved with features, but for regular profiles saved in DB I don't think it's possible to "restore" them if the update is applyed.

To solve that issue, shall we empty the 7302 and apply the corrected version (#13) as 7303 to start with?

anon’s picture

StatusFileSize
new2.1 KB

I think this patchs solves the issue with the broken update hook.
I have tested this from 3.2 to 3.x. Both when the broken 7302 is applied and not.

@punch: Your problem sounds like a feature export issue.

anon’s picture

Status: Needs work » Needs review
punch’s picture

No not a feature issue. Thanks for the #24 patch it solved almost my problem.
I have multiple profiles, but the patch only work on one.

You have if ($show_notice) {..} inside the foreach. It return from foreach first time it is TRUE. Placeing if ($show_notice) {..} after foreach solve this issue.

anon’s picture

@punch: Thanks, thats true, my bad.

anon’s picture

Status: Needs review » Fixed

Pushed patch 24.

  • anon committed 04dc349 on 7.x-3.x
    Issue #2427277 by anon, ashalan, ciss: Warning: Invalid argument...

Status: Fixed » Closed (fixed)

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