3.3.x Extensions Database 3.2 / 3.3Button index

<span class="qte-attr qte_32_33-qte">3.2.x & 3.3.x</span>
User avatar

SpIdErPiGgY
Users
Users
Posts: 120
Joined: 04 Feb 2021, 23:54
    Windows 10 Firefox

Re: Button index

Post by SpIdErPiGgY »

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/dmzx/buttonindex/controller/admin_controller.php on line 112: Trying to access array offset on false
System: Linux 6.1.0-26-cloud-amd64 • Forum version: 3.3.14
Web server: Apache
PHP version: 8.3.14
Database server: MySQL(i) 11.4.4-MariaDB-deb12
Operating system: Debian
🌐 phpBB extensies in het Nederlands
✦ Gratis vertalingen, updates, support en praktische tutorials voor phpBB.

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6485
Joined: 13 Jan 2014, 21:45
    Android Chrome

Re: Button index

Post by dmzx »

Onnozel Manneke wrote: 28 Nov 2024, 08:36

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/dmzx/buttonindex/controller/admin_controller.php on line 112: Trying to access array offset on false
System: Linux 6.1.0-26-cloud-amd64 • Forum version: 3.3.14
Web server: Apache
PHP version: 8.3.14
Database server: MySQL(i) 11.4.4-MariaDB-deb12
Operating system: Debian
Will check these errors for php 8.x

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6485
Joined: 13 Jan 2014, 21:45
    Windows 10 Chrome

Re: Button index

Post by dmzx »

First post updated.

User avatar

SpIdErPiGgY
Users
Users
Posts: 120
Joined: 04 Feb 2021, 23:54
    Windows 10 Firefox

Re: Button index

Post by SpIdErPiGgY »

Thank you for the update :mml:

User avatar

martin
Admin
Admin
Posts: 5123
Joined: 06 Apr 2014, 16:12
    Linux Chrome

Re: Button index

Post by martin »

New version on it's way here is a preview.
Screenshot from 2025-03-23 13-14-37.png
Screenshot from 2025-03-23 13-21-31.png
You do not have the required permissions to view the files attached to this post! Maybe your post count is too low.
Image

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 6485
Joined: 13 Jan 2014, 21:45
    Windows 10 Chrome

Re: Button index

Post by dmzx »

First post updated.

User avatar

SpIdErPiGgY
Users
Users
Posts: 120
Joined: 04 Feb 2021, 23:54
    Windows 10 Firefox

Re: Button index

Post by SpIdErPiGgY »

Thx for the update

User avatar

ssl
Users
Users
Posts: 139
Joined: 19 Aug 2020, 12:54
    Mac OS X Firefox

Re: Button index

Post by ssl »

French translation available here
phpBB: 3.3.15 | PHP: 8.4
[Some French translation of extensions]

User avatar

Blackcat
New user
New user
Posts: 1
Joined: 21 Aug 2025, 16:09
    Windows 10 Firefox

Re: Button index

Post by Blackcat »

Hello, I'm using this extension to add, among other things, the "New Topics" and "Active Topics" buttons to my forum 3.3.15,PHP 8.4.17, but I was getting an error with the "Active Topics" link.
Here is the error:

Code: Select all

SQL ERROR [ mysqli ] Incorrect integer value: '' for column 'buttonindex_fav' at row 1 [1366] SQL UPDATE phpbb_buttonindex SET buttonindex_text = 'Sujets Actifs', buttonindex = 'search.php?search_id=active_topics', buttonindex_fav = '' WHERE buttonindex_id = 3 BACKTRACE FILE: (not given by php) LINE: (not given by php) CALL: msg_handler() FILE: [ROOT]/phpbb/db/driver/driver.php LINE: 1031 CALL: trigger_error() FILE: [ROOT]/phpbb/db/driver/mysqli.php LINE: 216 CALL: phpbb\db\driver\driver->sql_error() FILE: [ROOT]/phpbb/db/driver/factory.php LINE: 353 CALL: phpbb\db\driver\mysqli->sql_query() FILE: [ROOT]/ext/dmzx/buttonindex/controller/admin_controller.php LINE: 196 CALL: phpbb\db\driver\factory->sql_query() FILE: [ROOT]/ext/dmzx/buttonindex/acp/acp_buttonindex_module.php LINE: 39 CALL: dmzx\buttonindex\controller\admin_controller->display_options() FILE: [ROOT]/includes/functions_module.php LINE: 684 CALL: dmzx\buttonindex\acp\acp_buttonindex_module->main() FILE: [ROOT]/adm/index.php LINE: 81 CALL: p_master->load_active()
Being a complete novice in this area, I asked an AI for help, and here is the solution it provided, along with this comment:
diff --git a/ext/dmzx/buttonindex/controller/admin_controller.php b/ext/dmzx/buttonindex/controller/admin_controller.php
index 3f4c2a1..9b7e6d4 100644
--- a/ext/dmzx/buttonindex/controller/admin_controller.php
+++ b/ext/dmzx/buttonindex/controller/admin_controller.php
@@ -183,7 +183,7 @@ class admin_controller
if (empty($errors))
{
$name = $this->db->sql_escape($this->request->variable('name', '', true));
$url = $this->db->sql_escape($this->request->variable('url', ''));
- $fav = $this->db->sql_escape($this->request->variable('fav', ''));
+ $fav = (int) $this->request->variable('fav', 0);

if ($name && $url && !$edit_id)
{

When adding or modifying a button, if the "favorite" option is not checked,

the extension sends an empty value ('') to the buttonindex_fav field, which is of type INT.

In a strict MySQL environment, this causes the error:
SQL ERROR 1366 – Incorrect integer value.

The attached fix forces the value to 0 or 1 via a cast (int),
which permanently resolves the issue and adheres to phpBB best practices.


This has indeed fixed my problem.
I'm posting this solely to share my experience and perhaps inspire you to make your own fix for this extension, which I appreciate.

Thank you.

Post Reply Previous topicNext topic