After enabling search, whenever I ran cron I would get pages and pages of Access Denied. The browser would display one for each node that was being indexed.
I finally figured out that it was only multichoice nodes that had this problem, and it's because of this access_denied() call in view:
/**
* Implementation of hook_view().
*/
function multichoice_view($node, $teaser = FALSE, $page = FALSE) {
if (!$teaser && $page) {
// This is not necessary:
//$mynode = node_prepare($node, $teaser);
$node->content['body'] = array('#value' => multichoice_render_question($node));
return $node;
}
elseif ($teaser) {
$node = node_prepare($node, $teaser);
return $node;
}
else {
drupal_access_denied();
}
}
For me this is the final nail in the coffin of multichoice and I'm switching to choice. I expect it'll be humming along nicely by 4.0 release. I thought about marking this "won't fix" but after some thought I realized we may keep multichoice in 4.0, however deprecated. Users may want to keep using multichoice if it's working for them, and maybe they have quiz results that depend on their multichoice nodes. Keeping it also gives us the option of not implementing a conversion system and instead having people export their multichoice questions and reimporting them to get choice questions.
Just some extra thoughts on a bug report.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | quiz.multichoice_access_denied.patch | 533 bytes | rfay |
| #14 | quiz_cron.png | 43.18 KB | patator |
Comments
Comment #1
turadg commentedCommitted a fix that removes access_denied() in multichoice_view().
This could really use some review as I'm not sure what the data protection implications are of this. Node access should be handled by other hooks, but I'm not sure they are.
Comment #2
turadg commentedThis is fixed well enough, considering that the multichoice module is completely redone by Falcon in 4.0.
Comment #4
mlncn commentedIn 3.3: Other weirdness from the multichoice content types:
warning: Invalid argument supplied for foreach() in /var/www/anjali/drupal/modules/taxonomy/taxonomy.module on line 1214.Comment #5
r_honey commentedHi turadg, can you provide the fix you committed. I have a production site using lots of multichoice questions filling up my log with "access denied" errors on each cron run.
Comment #6
patator commentedError cron has appeared with 4dev (new installation) or before has been installed 3.3?
Comment #7
r_honey commentedI have a Drupal 6.13 installation with Quiz 3.3.
Obviously, I cannot use dev versions on production sites. I am requesting a patch for 3.3. I checked the latest 3.3 dev branch. I did not see anything significantly changed from 3.3 there.
On 4 however, the 3 files in multichoice module have been replaced by a ton of files. And I could not locate the hook_view function that causes these access denied errors in 4.0 multichoice.module.
Comment #8
fredklopper commentedSubscribing
Comment #9
turadg commentedI can't find that patch now but it's quite simple. Just take out this line:
drupal_access_denied();
That'll leave the else{} block empty, so you might want to put something in there. That's what gets presented if the view is not a page or teaser, such as in a cron-initiated search indexing pass.
Comment #10
r_honey commentedIf I leave that else block empty (I am really not sure what to put in there), would that matter or generate any further problem, except for that the multichoice questions would not be indexed??
Comment #11
benoit.borrel commentedsubscribing
Comment #12
turadg commentedr_honey, I believe the only side-effect will be that the question is not search indexed. if you want to be safe, you could turn the elif into the else.
Comment #13
r_honey commentedThanx turadg, I updated multichoice.module as suggested by you. An immediate manual cron run after this updation completed successfully, without producing any "access denied" errors in log. I hope the 4.0 release would solve this problem.
As a side-note, I would also like to mention that I needed to hack into the Drupal core to prevent another problem caused due to the multichoice module, that I tried to discuss on a related thread mentioned below, but did not get any satisfactory reply:
http://drupal.org/node/259632#comment-2025530
This seems like due to some taxonomy term problems in multichoice nodes.
Comment #14
patator commentedI could not solve the problem. Updated quiz to 6.x-4.x-dev 2009-Oct-17. In end multichoice.module added the changes as proposed turadg. Launched update. Received an error. Cron runs with errors as before.
Comment #15
turadg commentedpatator, your report is unrelated to the "access denied" bug. the code you checked out doesn't have the access denied bug. the problem is with the database update hooks. you might report it on a new ticket. if so, be sure to specify what version of the code you were running before the code update. it would also help to include the MySQL DESCRIBE TABLE output on the multichoice table.
Comment #16
hanskuiters commentedAnother situation related to the "access denied" bug. When creating/editing a multichoise node, and hit 'preview', the same 'access denied' error occurs. Leaving the last 'else' empty, like turadg suggests, eliminates the error but leaves the preview empty.
So instead I copied two lines from the first 'if' to the last 'if'. And that gave a strange function, so I did a bit of rearrange.
Comment #17
skyredwangThis problem remains active in Drupal 6.14+Quiz.3.x-dev 2009-Oct-22. Please take a look.
Comment #18
rfayThis exact problem remains in 6.x-3.x-dev as of the 2009-12-27 version.
Comment #19
rfayHere is the patch in #12, essentially.
This should be released for 3.3, as it's a critical failure.
Comment #20
sivaji_ganesh_jojodae commented#19 needs work, read #16
So better patch to fix this bug would be the code in #16. Thanks, committed to quiz-3.x-dev.
Comment #21
rfaySo @sivaji, did you commit the better code (I hope?)