Tutorial: How to fix the Smilies Categories extension

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
View more smilies
Smilies
:sn-1: :sn-2: :sn-3: :sn-4: :sn-5: :sn-6: :sn-7: :sn-8: :sn-9: :sn-10: :sn-11: :sn-12: :sn-13: :sn-14: :sn-15: :sn-16: :sn-17: :sn-18: :sn-19: :sn-20: :sn-21: :sn-22: :sn-23: :sn-24: :sn-25: :sn-26: :sn-27: :sn-28: :sn-29: :sn-30: :sn-31: :sn-32: :sn-33: :sn-34: :sn-35: :sn-36: :sn-37: :D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
View more smilies

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review

I accept the Privacy policy.

   
  • Saved at

Expand view Topic review: Tutorial: How to fix the Smilies Categories extension

Re: Tutorial: How to fix the Smilies Categories extension

by Selene310187 » Wed Dec 07, 2022 10:35 pm

Altbert wrote: Wed Dec 07, 2022 10:17 pmHope you get some reaction of sylver35!
At the moment, I unable to check my messages on phpbb.com because I have very limited access to the forum when I'm logging in due to unknown reasons (can't the see content of the forum as well while being logged in). This happened after about one hour after my registration on their site.

I already contacted the administrators via the contact form asking them what did happen. I haven't got an answer yet.

Re: Tutorial: How to fix the Smilies Categories extension

by Altbert » Wed Dec 07, 2022 10:17 pm

Yes, the mysqli_fetchfield should only have one argument which is the result of the mysqli_data_seek function.

Hope you get some reaction of sylver35!

Re: Tutorial: How to fix the Smilies Categories extension

by Selene310187 » Wed Dec 07, 2022 9:25 pm

I just contacted sylver35, the author of the extension, via phpbb.com* and informed him about the bug and my solution.

* I especially created an account there today in order to send the message to the author


Edit: I added the word "tutorial" to the title of the thread to avoid (further) confusion :sn-37:.

Re: How to fix the Smilies Categories extension

by Altbert » Wed Dec 07, 2022 9:00 pm

At least you know the error is caused by the mysqli_data_seek function, argument #2. This argument expects an integer, either 0 or the number of fields -1.
I haven't look at the actual code, but fields in mysql(i) are zero based, and so the integer number of the last field is always (number of fields - 1). Could that be the problem?

Tutorial: How to fix the Smilies Categories extension

by Selene310187 » Wed Dec 07, 2022 7:00 pm

I recently installed the Smilies Categories* extension for phpBB created by Sylver35 from the French phpBB forum Breizh Code. Before I put the extension on the live forum of Modding on the Spectrum, I tested it on my test forum on my local machine.

(I recommend everyone testing stuff before you make changes to your live forum in case something goes wrong :sn-37:)

* The extension lets you place the smilies of the forum into categories which can be accessed via the "View more smilies" link above and below the Smilies section of the posting editor. The purpose of this extension is to keep the Smilies section organized when more and more smilies are added to the forum.


As soon as I try to access the "Configuration of categories" menu in the Admin Control Panel (the menu can be found under posting > messages), I got following error message:

Code: Select all

Fatal error: Uncaught TypeError: mysqli_data_seek(): Argument #2 ($offset) must be of type int, mysqli_result given in C:\xampp\htdocs\modding-on-the-spectrum.com\phpbb\db\driver\mysqli.php:288 Stack trace: #0 C:\xampp\htdocs\modding-on-the-spectrum.com\phpbb\db\driver\mysqli.php(288): mysqli_data_seek(Object(mysqli_result), Object(mysqli_result)) #1 C:\xampp\htdocs\modding-on-the-spectrum.com\phpbb\db\driver\driver.php(381): phpbb\db\driver\mysqli->sql_rowseek(Object(mysqli_result), Object(mysqli_result)) #2 C:\xampp\htdocs\modding-on-the-spectrum.com\phpbb\db\driver\factory.php(297): phpbb\db\driver\driver->sql_fetchfield('maxi', Object(mysqli_result), Object(mysqli_result)) #3 C:\xampp\htdocs\modding-on-the-spectrum.com\ext\sylver35\smiliescat\core\category.php(153): phpbb\db\driver\factory->sql_fetchfield('maxi', Object(mysqli_result)) #4 C:\xampp\htdocs\modding-on-the-spectrum.com\ext\sylver35\smiliescat\core\category.php(461): sylver35\smiliescat\core\category->get_max_order() #5 C:\xampp\htdocs\modding-on-the-spectrum.com\ext\sylver35\smiliescat\controller\admin_controller.php(194): sylver35\smiliescat\core\category->adm_list_cat('./../adm/index....') #6 C:\xampp\htdocs\modding-on-the-spectrum.com\ext\sylver35\smiliescat\acp\main_module.php(53): sylver35\smiliescat\controller\admin_controller->acp_categories_config() #7 C:\xampp\htdocs\modding-on-the-spectrum.com\includes\functions_module.php(676): sylver35\smiliescat\acp\main_module->main('\\sylver35\\smili...', 'config') #8 C:\xampp\htdocs\modding-on-the-spectrum.com\adm\index.php(81): p_master->load_active() #9 {main} thrown in C:\xampp\htdocs\modding-on-the-spectrum.com\phpbb\db\driver\mysqli.php on line 288
I got a similar error message when I tried to change the name of a category.

Additional information: The forum uses phpBB 3.3.9 and runs on PHP 8.1 as I'm writing this.


I figured out that it has something to do with the sql_fetchfield function having too many arguments (I found the final hint in this post).

So I checked the lines of code that contain the sql_fetchfield functions in the category.php (ext\sylver35\smiliescat\core). The sql_fetchfield functions in these line have too many arguments: lines 153, 165 and 390.



Find:

Code: Select all

$max = $this->db->sql_fetchfield('maxi', $result);
(line 153)


Replace with

Code: Select all

$max = $this->db->sql_fetchfield('maxi');



Find:

Code: Select all

$id_max = (int) $this->db->sql_fetchfield('id_max', $result);
(line 165)


Replace with

Code: Select all

$id_max = (int) $this->db->sql_fetchfield('id_max');



Find:

Code: Select all

$total = (int) $this->db->sql_fetchfield('total', $result);
(line 390)


Replace with

Code: Select all

$total = (int) $this->db->sql_fetchfield('total');

Top