Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
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
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.
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost
@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
Gregor
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost
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.
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.
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost
I believe I found the error.
It seems to be in /lib/translation.functions.php, line 34, which should be
instead of
Complete explanation
The problem lies in the function lang()
1) $params is initialized to array()
2) the number of parameters of the function lang() is checked. In the guestbook-case there is only 1 parameter
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.
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
It seems to be in /lib/translation.functions.php, line 34, which should be
Code: Select all
$params = NULL;
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';
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 '';
}
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 --";
}
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
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost
@Cerno: just applied your sugestion, and got rid of the error 
Thanks for your work!
Gregor

Thanks for your work!
Gregor
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
This issue is still in CMSMS 1.1.1 Upolu
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
The root cause is in class.guestbook.php. Change line 767 from
to
Code: Select all
$delconf = lang('deleteconfirm');
Code: Select all
$delconf = lang('deleteconfirm', $r);
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhost
Update to version 1.1.1 and made the mentioned fix: problem solved
Anyone who would like to upgrade svn?

Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
I'll post the solution in the QA-area. Someone then can change it in the SVN version.
Ronny
Ronny
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
It is already in the SVN
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
Ronny, where is this QA area?
Re: Guestbook error: Warning: vsprintf(): Too few arguments in /home/httpd/vhosts/ca
The other post was in the QA area, where you replied that you put it in SVN.
Ronny
Ronny