Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
emt
Forum Members
Forum Members
Posts: 20
Joined: Mon Jul 16, 2007 5:37 pm
Location: Athens, GA US

Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by emt »

I posted this as a bug in the Development, Guestbook forum last night, but thought I would put here so more people would see it. Just in case someone else is seeing this problem too!

Marshall


Installed new CMSMS 1.1 "Samoa", added modules Guestbook 1.1.9 and Captcha 0.3.

In the CMSMS admin, under Content, Guestbook, the following message is appearing for each message posted (only posted two test messages and two errors are showing).

Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/cattycattyways.com/httpdocs/beta/lib/translation.functions.php on line 62

The message appears between the the "Manage Guestbook" tabs and the table showing the message.

I'm not sure if this is a Guestbook or CMSMS problem. I had previously installed Guestbook 1.1.9 on CMSMS 1.0.4 "Lanai" and did not experience this problem. (Same server, but different domain)

So based on those facts, I'm posting this as a bug report for Guestbook.

Thank you,
Marshall
Last edited by emt on Tue Jul 17, 2007 1:07 pm, edited 1 time in total.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost

Post by Gregor »

@Marshall, I experience this problem too after upgrading to cmsms 1.1 I also copied all files of Guestbook 1.1.9 to the server, because in the module manger it says "cannot download". The version stays to 1.1.2, I don't know how to continue this upgrade of the guestbook.

Gregor
b0n3m4n

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost

Post by b0n3m4n »

Same here.

I'm using a fresh 1.1 Samoa install plus guestbook 1.1.9 installed via Module Manager without Captcha.
There is one error line for each guestbook entry shown in the admin section.
b0n3m4n

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost

Post by b0n3m4n »

I believe I found the error.

It seems to be in /lib/translation.functions.php, line 34, which should be

Code: Select all

$params = NULL;
instead of

Code: Select all

$params = array();


Complete explanation

The problem lies in the function lang()

1) $params is initialized to array()

Code: Select all

	$name = '';
	$params = array();
	$realm = 'admin';
2) the number of parameters of the function lang() is checked. In the guestbook-case there is only 1 parameter

Code: Select all

	if (func_num_args() > 0)
	{
		$name = func_get_arg(0);
		if (func_num_args() == 2 && is_array(func_get_arg(1)))
		{
			$params = func_get_arg(1);
		}
		else if (func_num_args() > 1)
		{
			$params = array_slice(func_get_args(), 1);
		}
	}
	else
	{
		return '';
	}
since in this case func_num_args = 1 the variable $params remains unchanged, so this is still the case: $params = array()

3) this next step is supposed to handle the the different parameter cases differently. In our case we have only 1 parameter, so we need $result = $lang[$realm][$name]; to be executed.

Code: Select all


	$result = '';

	if (isset($lang[$realm][$name]))
	{
		if (isset($params))
		{
			$result = vsprintf($lang[$realm][$name], $params);
		}
		else
		{
			$result = $lang[$realm][$name];
		}
	}
	else
	{
		$result = "--Add Me - $name --";
	}
But, lo, isset($params) returns TRUE because $params has been initialized to array() in the beginning so the line we need to be executed can never be executed.

Thus I believe $params was meant to be initialized as NULL instead of array().

I tried changing it and it got rid of the error.
Can anyone confirm this who knows their way around this stuff better than I do?

Cheers,
Cerno
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost

Post by Gregor »

@Cerno: just applied your sugestion, and got rid of the error :)

Thanks for your work!
Gregor
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by tobik »

This issue is still in CMSMS 1.1.1 Upolu
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by tobik »

The root cause is in class.guestbook.php. Change line 767 from

Code: Select all

$delconf        = lang('deleteconfirm');
to

Code: Select all

$delconf        = lang('deleteconfirm', $r);
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am
Location: The Netherlands

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost

Post by Gregor »

Update to version 1.1.1 and made the mentioned fix: problem solved :) Anyone who would like to upgrade svn?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by RonnyK »

I'll post the solution in the QA-area. Someone then can change it in the SVN version.

Ronny
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by tobik »

It is already in the SVN
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by tobik »

Ronny, where is this QA area?
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by RonnyK »

The other post was in the QA area, where you replied  that you put it in SVN.

Ronny
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca

Post by tobik »

Ah, I see. Thanks
Post Reply

Return to “Modules/Add-Ons”