Solved: Comment Plugin: Fatal error

Found a bug? Tell us!!
Post Reply
moonchild
Regular
Posts: 201
Joined: Mon Nov 21, 2005 11:23 pm
Location: Esslingen
Contact:

Solved: Comment Plugin: Fatal error

Post by moonchild »

Hi there,
after Update from last beta to 2.4.0 and PHP 8.0.25, I've got the following error messages:

[code]Fatal error: Uncaught TypeError: mb_strrpos(): Argument #3 ($offset) must be of type int, string given in /home/www/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php:252 Stack trace: #0 /home/www/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php(252): mb_strrpos('Das [url=https:...', ' ', 'UTF-8') #1 /home/www/include/plugin_api.inc.php(971): serendipity_plugin_comments->generate_content('Kommentare') #2 /home/www/include/functions_smarty.inc.php(644): serendipity_plugin_api::generate_plugins('right') #3 /home/www/templates_c/2k11/a8/5f/53/a85f53ad4b5145e2bcf9add0f50dd03773b19c78_0.file.index.tpl.php(176): serendipity_smarty_printSidebar(Array, Object(Smarty_Internal_Template)) #4 /home/www/bundled-libs/Smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_637a8c3deb2662_80154294(Object(Smarty_Internal_Template)) #5 /home/www/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #6 /home/www/bundled-libs/Smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template)) #7 /home/www/bundled-libs/Smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1) #8 /home/www/bundled-libs/Smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, NULL, NULL, 1) #9 /home/www/index.php(124): Smarty_Internal_TemplateBase->display('/home/www/ww740...') #10 {main} thrown in /home/www/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php on line 252[/code]

Any hints apreciated,
Thomas
Last edited by moonchild on Wed Nov 23, 2022 8:51 am, edited 2 times in total.
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Comment Plugin: Fatal error

Post by onli »

This is a bug in 2.4.0. Sadly, it's a bug in a core plugin, so we can't fix it easily via a spartacus update.

If you want to fix it yourself, edit the file plugins/serendipity_plugins_comments/serendipity_plugin_comments.php. In line 252 is this code:

Code: Select all

$spacepos = mb_strrpos(mb_substr($comment, $pos, $wordwrap, $enc), ' ', $enc);
Replace it with:

Code: Select all

$spacepos = mb_strrpos(mb_substr($comment, $pos, $wordwrap, $enc), ' ', 0, $enc);
If you prefer to see this patch on Github, it was pushed with this commit.
moonchild
Regular
Posts: 201
Joined: Mon Nov 21, 2005 11:23 pm
Location: Esslingen
Contact:

Re: Comment Plugin: Fatal error

Post by moonchild »

Hi there,
many thanks for the quick response, it is now working perfectly again :-)

Greetings,
Thomas
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Comment Plugin: Fatal error

Post by onli »

Thanks for the report and the test :) I also pushed the fix into the github master, so the next release should include it. Let's see whether some additional fixes come up.
Post Reply