Page 1 of 1

Bug in serendipity_plugin_comments.php

Posted: Fri Sep 19, 2003 11:52 pm
by bullvi
I'm running the CVS version of Serendipity (09/19/03), the serendipity_plugin_comments.php generates the following errors:

Code: Select all

Warning: Wrong parameter count for setlocale() in /home/virtual/site21/fst/var/www/html/mutant/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php on line 95

Warning: Invalid argument supplied for foreach() in /home/virtual/site21/fst/var/www/html/mutant/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php on line 116
I searched for setlocale in the directory, and the only place that uses setlocale is this plugin:

Code: Select all

> find ./ -type f -exec grep -HI "setlocale" {} \;
./plugins/serendipity_plugin_comments/serendipity_plugin_comments.php:                    $loc = setlocale(LC_ALL,  'de_DE', 'de_DE@euro', 'de', 'ge');
./plugins/serendipity_plugin_comments/serendipity_plugin_comments.php:                    $loc = setlocale(LC_ALL,  'en_US', 'en_EN', 'en', 'us');
The second error is a foreach database access error, I've not been able to fix it yet, if I do I'll post what I did.

Take care,

--Brian

Posted: Fri Sep 26, 2003 11:51 pm
by bullvi
Changing this:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL,  'en_US', 'en_EN', 'en', 'us');
                    $out = '%s about%s';
                break;
to:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL, 'en');
                    $out = '%s about%s';
                break;
Makes comments work. Just FYI if your having this problem.

Posted: Sat Sep 27, 2003 8:58 pm
by tomsommer
bullvi wrote:Changing this:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL,  'en_US', 'en_EN', 'en', 'us');
                    $out = '%s about%s';
                break;
to:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL, 'en');
                    $out = '%s about%s';
                break;
Makes comments work. Just FYI if your having this problem.
Thanks, will fix it :)

Posted: Tue Sep 30, 2003 11:44 pm
by garvinhicking
tomsommer wrote:
bullvi wrote:Changing this:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL,  'en_US', 'en_EN', 'en', 'us');
                    $out = '%s about%s';
                break;
to:

Code: Select all

            case 'en':
                    $loc = setlocale(LC_ALL, 'en');
                    $out = '%s about%s';
                break;
Makes comments work. Just FYI if your having this problem.
Thanks, will fix it :)
FYI: setlocale accepts multiple calls since PHP 4.3.0. I don't know which PHP we currently require, but the previous setlocale-string covered more webserver installations...

Regards,
Garvin.

Posted: Tue Sep 30, 2003 11:46 pm
by tomsommer
garvinhicking wrote:FYI: setlocale accepts multiple calls since PHP 4.3.0. I don't know which PHP we currently require, but the previous setlocale-string covered more webserver installations...
I know, but it's bad BC...

We even have a file_get_contents if the function doesn't exist

We support 4.1.2 i guess or 4.2.2

Posted: Sat Oct 11, 2003 11:19 am
by Guest
Another point, with the comment plugin: if there are no comments yet, the sidebar displays an error message:
Warning: Invalid argument supplied for foreach() in C:\Dokumente und Einstellungen\Thor Odinson\Eigene Dateien\localhost\Personal Homepage v2b\serendipity\plugins\serendipity_plugin_comments\serendipity_plugin_comments.php on line 116
Changing

Code: Select all

if ($sql) {
to

Code: Select all

if ($sql && is_array($sql)) {
in serendipity_plugin_comments.php on line 115 should help.

cu, Timo

Posted: Sat Oct 11, 2003 6:47 pm
by Guest
And another one: the date-format option is not working, as the variable "date_format" on line 66 should be "dateformat".
Timo

Posted: Sat Oct 11, 2003 6:51 pm
by tomsommer
Thanks, all fixed now