hello.

I am getting this error when going for example to domain.com/admin/settings/simplenews/general

warning: Invalid argument supplied for foreach() in /includes/form.inc on line 1193.

I saw similar issues when performing a search on drupal.org, but all of them seem to be related to other modules.

drupal 6.8 simplenews 6.1.0 rc2

CommentFileSizeAuthor
#4 simplenews.356181.patch1.08 KBsutharsan

Comments

jcbrew’s picture

I'm getting the same error when trying to use TinyMCE

Drupal 6.8
TinyMCE 6.x-1.1-dev
TinyMCE (Moxiecode file) 3.2.1.1

sutharsan’s picture

Status: Active » Postponed (maintainer needs more info)

I can not reproduce it and have no idea what causes this error. Do you use a module what does something with taxonomy?
You need to debug the code. For example by inserting

drupal_set_message(print_r($form['#default_value'], true));

Before line 1193 in form.inc and report the result here.

mohammed76’s picture

hi.

I copied the suggested line to form.inc before line 1193 which made the editor shift the offending line to 1195. I didn't get anything different when going to the setting page. still same error. warning: Invalid argument supplied for foreach() in /includes/form.inc on line 1195.

how can I trouble shoot it more?

sutharsan’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.08 KB

Did you get any message, except the fault message?
Do you use a module what does something with taxonomy?
Do you have some kind of access restriction on taxonomies?

The attached patch will solve the error, but I would be very interested in finding out what the cause of this is.

The problem comes from line 739 (latest HEAD) of simplenews.admin.inc (first line in below code)

  $vocabulary = taxonomy_vocabulary_load(variable_get('simplenews_vid', ''));
  $form['simplenews_general_settings']['simplenews_content_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#required' => TRUE,
    '#options' => array_map('check_plain', node_get_types('names')),
    '#default_value' => isset($vocabulary) ? $vocabulary->nodes : array(),
    '#description' => t('Content types to be used as newsletter.'),
  );

Perhaps you can find out why taxonomy_vocabulary_load() does not return a $vocabulary->nodes (NULL value).

mohammed76’s picture

Version: 6.x-1.0-rc2 » 6.x-1.x-dev

hi.

installing the dev version of simplenews doesn't change the situation.
let me give you as much information as I can.

1. simplenews was the last module that I installed that has to do with taxonomy directly. the other module is the core forum module.

2. when I first installed the module, it created a default newsletter and it automatically named it تقنيات الكفيف العربي newsletter. notice that my site name is arabic. however, after navigating through the module pages in both the content and site configuration categories, suddenly the default newsletter got deleted on its own. I don't remember what I was doing then, but I sure went to admin/build/block to assign the newsletter block to the right side bar but didn't find it.

3. when I installed the dev version today and tried to create the newsletter by the same arabic name, the news letter was created successfully, and a matching taxonomy term was created. however, going to admin/settings/simplenews/general I still get that same error.

4. I still haven't tried to delete the newsletter and create a test news letter and give it an english name, as I suspect that none latin characters have to do with the problem. let me know if that test would be useful.

5. thanks for the patch, but I can't apply it on my own, still haven't learned how to apply patches.

thank you.

mohammed76’s picture

here is more info after some troubleshooting:

1. renaming the news letter to something in english doesn't seem to be related as this didn't do anything

2. something worth noting in admin/settings/simplenews/general page: I noticed that no content type was selected, although I saw newsletter issue checked in the past. second, no vocabulary was selected and I only had one vocab called forums automatically created by the core forum module.

3. manually creating a vocabulary name newsletters and then assigning it as the default vocabulary results in deleting the newsletter that was present. but I no longer see that argument error, instead I get this: Array ( [simplenews] => simplenews ) I know it's not complete, but that is all that is displayed.

4. I create yet a new newsletter and gave it an arabic name. this worked ok. but this newsletter is assigned id number 3. trying to change the edit page url to /2 or /1 results in not found page.

hope the above is useful.

sutharsan’s picture

This all fits into my image of the problem. Thanks for the details.
Please explain "results in deleting the newsletter that was present" in your no. 3
The message "Array ( [simplenews] => simplenews )" is the result of #2. Simply remove the added line.
The id number of the vocabulary is no problem, no need to change it.

I decided to commit the patch. It will prevent the error messages. But still I have no idea what caused the vocabulary to loose it's node type settings. What did you do before you saw the error?

mohammed76’s picture

what I meant by number 3 was that I had a newsletter id number 2. when I manually created the vocabulary and assigned it to the newsletter in /admin/settings/simplenews/general, I found that even the newsletter id number 2 was deleted. I created a newsletter that was given id number 3, and uploaded an unmodified version of form.inc. now everything seems to be working normally with no errors.

I didn't notice the step that made the newsletter loos its content type associations. but I missed it when I tried to associate the newsletter block to one of my sidebars.

if there's something else you want me to do I will be more than happy to do it. otherwise, feel free to mark issue as fixed.

sutharsan’s picture

Status: Needs review » Fixed

@mohammed76, thanks for your quick response to this issue.

@jcbrew if the last 6.x-1.x-dev (new release in a couple of hours) does not solve your problem, feel free to reopen the issue.

mohammed76’s picture

jcbrew's problem is with the tiny mc editor not with simplenews. it was I who reported the issue. since I managed to solve it without the patch, I won't be able to test the new dev release. however, what I can do is I can install it on a fresh installation just for testing.

thank you very much. looking forward for the new dev release.

Status: Fixed » Closed (fixed)

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