Bug in serendipity_plugin_comments.php

Found a bug? Tell us!!
Post Reply
bullvi
Regular
Posts: 16
Joined: Sat Sep 06, 2003 1:52 pm

Bug in serendipity_plugin_comments.php

Post 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
bullvi
Regular
Posts: 16
Joined: Sat Sep 06, 2003 1:52 pm

Post 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.
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post 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 :)
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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.
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post 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
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Guest

Post 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
Guest

Post by Guest »

And another one: the date-format option is not working, as the variable "date_format" on line 66 should be "dateformat".
Timo
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

Thanks, all fixed now
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Post Reply