RecentTopics
RecentTopics copied to clipboard
bug: enabled option "show all pages" not compatible with php8 - board crashes
Also as described here: https://www.phpbb.com/customise/db/extension/recent_topics_2/support/topic/230081
recent topics doesnt work with php8 when you have enabled "show all pages", everything ist fine when you disable this option, or switch back from php8 to php74
tested and reproduced with recent topic 2.2.15 and phpbb 3.3.3, as well as 3.3.4
Errors from the error log:
[10-Apr-2021 23:24:15 Europe/Berlin] PHP Fatal error: Uncaught TypeError: mysqli_data_seek(): Argument #2 ($offset) must be of type int, mysqli_result given in /home/webn73d9c/html/phpBB/phpbb/db/driver/mysqli.php:281 Stack trace: [code]#0 /home/webn73d9c/html/phpBB/phpbb/db/driver/mysqli.php(281): mysqli_data_seek(Object(mysqli_result), Object(mysqli_result)) #1 /home/webn73d9c/html/phpBB/phpbb/db/driver/driver.php(381): phpbb\db\driver\mysqli->sql_rowseek(Object(mysqli_result), Object(mysqli_result)) #2 /home/webn73d9c/html/phpBB/phpbb/db/driver/factory.php(297): phpbb\db\driver\driver->sql_fetchfield('topic_count', Object(mysqli_result), Object(mysqli_result)) #3 /home/webn73d9c/html/phpBB/ext/paybas/recenttopics/core/recenttopics.php(311): phpbb\db\driver\factory->sql_fetchfield('topic_count', Object(mysqli_result)) #4 /home/webn73d9c/html/phpBB/ext/paybas/recenttopics/event/listener.php(71): paybas\recenttopics\core\recenttopics->display_recent_topics() #5 /home/webn73d9c/html/phpBB/vendor/symfony/event-dispatcher/EventDispatcher.php(214): paybas\recenttopics\event\listener->display_rt(Object(phpbb\event\data), 'core.index_modi...', Object(phpbb\event\dispatcher)) #6 /home/webn73d9c/html/phpBB/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'core.index_modi...', Object(phpbb\event\data)) #7 /home/webn73d9c/html/phpBB/phpbb/event/dispatcher.php(62): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('core.index_modi...', Object(phpbb\event\data)) #8 /home/webn73d9c/html/phpBB/phpbb/event/dispatcher.php(46): phpbb\event\dispatcher->dispatch('core.index_modi...', Object(phpbb\event\data)) #9 /home/webn73d9c/html/phpBB/index.php(244): phpbb\event\dispatcher->trigger_event('core.index_modi...', Array) #10 {main}[/code] thrown in /home/webn73d9c/html/phpBB/phpbb/db/driver/mysqli.php on line 281
I fixed the bug.
I change in the /paybas/recenttopics/core/recenttopics.php the line 311 from
$this->total_topics_limit = (int) $this->db->sql_fetchfield('topic_count', $result);
to
$this->total_topics_limit = (int) $this->db->sql_fetchfield('topic_count');
Tested with phpBB 3.3.3, 3.3.9-RC and php 8.0