I add a question, but it says "No question defined. " Also displays an error: Problem loading question in node 76 .

I tried creating my own questions, but when I got this error, I decided to test it with your example, and still it doesn't work...

CommentFileSizeAuthor
#9 example.jpg49.75 KBKarinaj

Comments

jvdkolk’s picture

How to reproduce this error:

1) Create a new question
2) Leave the XML blank
3) Save the question

You will get a PHP warning

warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in /drupal/sites/all/modules/closedquestion/question/FactoryQuestion.inc.php on line 85.
Problem loading question in node 1709

HylkeVDS’s picture

Karinaj, did you get any other errors?
I would expect an error from the XML parser, similar to what rekcor mentioned. If your installation has error reporting turned off you might have to look in the log files of your http server.

Karinaj’s picture

Hi,

I find 3 warnings in a log:
Notice: Undefined variable: question - cq_question_from_xml() (eilutė 96 iš /home/svedukal/public_html/sites/all/modules/closedquestion/question/FactoryQuestion.inc.php).

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input - cq_question_from_xml() (eilutė 85 iš /home/svedukal/public_html/sites/all/modules/closedquestion/question/FactoryQuestion.inc.php).

Notice: Undefined index: und - closedquestion_load() (eilutė 307 iš /home/svedukal/public_html/sites/all/modules/closedquestion/closedquestion.module).

I don't know why it says "Empty string supplied as input" - it's not empty at all.

HylkeVDS’s picture

Ah, I just realised you're using a non-english translation of Drupal. In D7 the handling of translations changed, the port of ClosedQuestion doesn't deal with that yet, so apparently it's looking in the location of the English version.

Karinaj’s picture

I have a test site, that is only in English, but it's the same.

HylkeVDS’s picture

The message "Notice: Undefined index: und" means the language is not set to the default ("und" means "undefined" I just found out)

I've updated the 7.x dev release that should fix it. Can you try that, once the build scripts have re-build it?
It also shows the language code the node uses, what does it list for you?

Karinaj’s picture

Hmm, the date at the 7.x dev release is still March 28, others are March 29 :)
Language code is English (in general I have three available languages - English, Swedish and Lithuanian), and, as I said, I have another site, for testing, developing, so that other site has only English language. I have installed Closed Question on my test site, but I get the same error messages, so probably it's something else, not the language issue?

HylkeVDS’s picture

The build scripts on development builds run only every so often. You could try to apply the patch manually:
http://drupalcode.org/project/closedquestion.git/commitdiff/c5d6478?hp=3...

Just adding the following to the function closedquestion_load should give us enough information to see if it really is the problem:

$lang = $node->language;
drupal_set_message(t('Language = %lang', array('%lang'=>$lang)));

Explicitly setting it to English is different than leaving it undefined.

Karinaj’s picture

StatusFileSize
new49.75 KB

Hi,
now it's better, but not completely. I attached an image of what happens. I didn't create my own question, just copy-pasted a single-choice example from your examples.

Karinaj’s picture

warnings:
Notice: Undefined index: und in CqQuestionAbstract->initialise() (line 200 of /home/svedukal/public_html/sites/all/modules/closedquestion/question/CqQuestionAbstract.class.php).

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in CqQuestionAbstract->initialise() (line 205 of /home/svedukal/public_html/sites/all/modules/closedquestion/question/CqQuestionAbstract.class.php).

HylkeVDS’s picture

Ah, yes, another one.
In a few moments 7.x-2.0-beta2 should be on-line. Can you try that one?
It's an updated version with all the improvements of the 6.x-2.x branch. It does have one additional dependency, on the libraries module. http://drupal.org/project/libraries

It also needs some extra javascript libraries, but it also works if you don't install those on your own server. In that case it will use versions of a remote server.

HylkeVDS’s picture

I found one last reference to 'und', it's in lib/XmlLib.inc.php

Change line 108 from:

    $retval = check_markup(trim($retval), $drupal_node->body['und'][0]['format'], FALSE);

to:

    $lang = $drupal_node->language;
    $retval = check_markup(trim($retval), $drupal_node->body[$lang][0]['format'], FALSE);
Karinaj’s picture

It works, it works!
I installed the new version, and it finally works. Thanks a lot!
I can see that it has an interface for editing now. It's really very usefull. I like this module.

HylkeVDS’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Closed (fixed)

You're welcome :)