When I try to show the FAQ with the "Clicking on question opens/hides answer under question" option, I get the following error:

warning: sprintf() [function.sprintf]: Too few arguments in /home/.jockey/awesomeadmin/awropla.com/modules/faq/faq.module on line 1174.
CommentFileSizeAuthor
#9 faq_181149.patch4.14 KBstella

Comments

phasmaphobic’s picture

Weird. After resetting all settings to default and putting them back in the same way, I no longer get this error.

Ah well! =)

stella’s picture

Assigned: Unassigned » stella
Status: Active » Fixed

Okay, well marking as fixed for now then. If it happens again, please re-open this issue.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)
sunish.net’s picture

Title: "Too few arguments" error » "Too few arguments" error on line 1072
Version: 5.x-2.4 » 5.x-2.5
Status: Closed (fixed) » Active

No error if Categorize questions is unticked

If Categorize questions is checked and the option Clicking on category opens/hides questions and answers under category selected
and all other options on the categories tab are unchecked there seems to be no problem.

Once Show FAQ count is checked, the error appears.
basically its to do with FAQ category options

stella’s picture

Is there any "%" sign in the question text?

Cheers,
Stella

dizwell’s picture

Component: Miscellaneous » Code

I'd just like to confirm the problem is real and it doesn't depend on having % marks in the questions. I put 16 questions together in one category, with the 'click question to reveal answer' option selected, as well as the 'display a count of questions next to category' option on. All worked fine. I added a new category and then 8 new questions for that new category, and immediately got the 'sprintf() too few arguments' error. None of the new questions had % characters in them, though one had an & character. I removed the ampersand and the problem was still there. I then switched off the 'display count' option and everything displayed correctly.

Needless to say, it would be nice to have the count back!

trusche’s picture

This problem is caused by one or more percent signs in the FAQ text if "Show FAQ count" is checked in the categories configuration. It's caused by this statement sequence:

if ($display_vars['faq_count']) $header .= " (%d)";
...
if ($display_vars['faq_count']) $output = sprintf($output, $count);

Here's a quick fix: replace all occurrences of the above lines with something like this:

if ($display_vars['faq_count']) $header .= " (%%FAQ_COUNT%%)";
...
if ($display_vars['faq_count']) $output = str_replace('%%FAQ_COUNT%%', $count, $output);

I'm sure there are more elegant ways to solve this problem, but at least it works :)

Hope this helps,
Thilo

stella’s picture

marked #187623 as a duplicate of this issue. Patch coming shortly.

stella’s picture

Status: Active » Fixed
StatusFileSize
new4.14 KB

Patch attached and the fix has also been checked into CVS so it should be available in the next dev version.

Cheers,
Stella

spidersilk’s picture

I was getting this error as well (and no, there are no % signs in the one question I've entered thus far). I tried to apply the patch (following the procedure at http://drupal.org/patch/apply) and got this:

(Stripping trailing CRs from patch.)
can't find file to patch at input line 8
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: faq.module
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v
|retrieving revision 1.1.4.63.2.1
|diff -u -r1.1.4.63.2.1 faq.module
|--- faq.module 22 Oct 2007 10:21:59 -0000 1.1.4.63.2.1
|+++ faq.module 30 Oct 2007 15:27:11 -0000
--------------------------
File to patch:

So I entered the path to the faq.module file, hoping that would help, and got this:

patching file modules/faq/faq.module
Hunk #1 FAILED at 1.
1 out of 10 hunks FAILED -- saving rejects to file modules/faq/faq.module.rej

Any idea what I might be doing wrong?

stella’s picture

Try the dev release. It's stable and includes the patch for this.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

stella’s picture

Released in faq 5.x-2.6.

Cheers,
Stella