This board is the new home for david63's extensions.

All of the extensions hosted here will need to be treated as a new install as there is no migration from the original ones to these, and furthermore, no support will be given to migrating to any of these extensions from previous versions.


Due to the selfishness of certain board members it has become necessary to apply a limit of how many downloads each member can make before making a donation. Once a donation has been made then you will have unlimited downloads.

[3.3.0] Forum Subs

Fully working extensions
doublejay
Member
Member
Posts: 5
Joined: November 2023

Re: [3.3.0] Forum Subs

#61

Post by doublejay »

So the problem is the extensions code is not DB agnostic.

If you use mySQL everything is fine, because mysqli_query will return a mysqli_result class. This class has a "num_rows" property:
https://www.php.net/manual/en/class.mysqli-result.php

But, if you use PostgreSQL as backend, pg_query is used by phpBBs DB driver, which returns a PgSql\Result class. This class has no "num_rows" property (it has no properties at all):
https://www.php.net/manual/en/class.pgsql-result.php

Thus, trying to access "num_rows" on a Postgres result will issue a Warning.

Edit: For Postgres, you would have to use pg_num_rows($result) instead of $result->num_rows. But of course then it will fail for everything that is not postgres.I don't know what the "phpBB way" of solving this is, but the root cause seems to be clear.

User avatar
devspace
Owner
Owner
Posts: 284
Joined: October 2022

Re: [3.3.0] Forum Subs

#62

Post by devspace »

Do you have this problem with PHP 8.1?

Whilst some/most of phpBB will work with PHP 8.2 the upper PHP version is still at 8.1

This may well be a bug in phpBB's dbal with PHP 8.2 and needs to be reported in phpBB's bug tracker.

doublejay
Member
Member
Posts: 5
Joined: November 2023

Re: [3.3.0] Forum Subs

#63

Post by doublejay »

No, it's because you are using code that only works with MySQL.

Please read my last post again. Accessing a "num_rows" property only works with MySQL. With PostgreSQL you get a completely different result class, one that has no such property.

Your code is not DB agnostic. It has nothing to do with PHP 8.2 or phpBB dbal.

nou nou
Donor
Donor
Posts: 1
Joined: November 2022

Re: [3.3.0] Forum Subs

#64

Post by nou nou »

Hello,


Trying to use Forum Subscriptions but getting these errors:

Code: Select all

General Error
SQL ERROR [ mysqli ]

Unknown column 'u.username' in 'field list' [1054]

SQL

SELECT u.user_id, u.username, u.username_clean, u.user_colour, fw.forum_id FROM (phpbb_ailabs_users u CROSS JOIN phpbb_forums_watch fw) WHERE u.user_id = fw.user_id AND fw.forum_id = 60 ORDER BY u.username_clean

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: 202
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/devspace/forumsubs/core/ext_functions.php
LINE: 203
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/ext/devspace/forumsubs/controller/admin_controller.php
LINE: 83
CALL: devspace\forumsubs\core\ext_functions->get_subscribed_users()

FILE: [ROOT]/ext/devspace/forumsubs/acp/acp_forumsubs_module.php
LINE: 26
CALL: devspace\forumsubs\controller\admin_controller->display_output()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: devspace\forumsubs\acp\acp_forumsubs_module->main()

FILE: [ROOT]/adm/index.php
LINE: 81
CALL: p_master->load_active()
When I go to ACP_USER_UTILS/Forum Subscriptions in the ACP

I also get this when I want to go to the Subscriptions page in the User Administer ACP:

Code: Select all

General Error
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [1064]

An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.

Previously, I did have this message when trying to enable the extension:

Code: Select all

Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.

A module already exists: ACP_USER_UTILS

Return to the extension list
And when trying a second time:

Code: Select all

General Error
SQL ERROR [ mysqli ]

Duplicate entry 'devspace/forumsubs' for key 'phpbb_ext.ext_name' [1062]

SQL

INSERT INTO phpbb_ext (ext_name, ext_active, ext_state) VALUES ('devspace/forumsubs', 0, 'b:1;')

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: 202
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]/phpbb/extension/manager.php
LINE: 179
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/phpbb/extension/manager.php
LINE: 241
CALL: phpbb\extension\manager->update_state()

FILE: [ROOT]/includes/acp/acp_extensions.php
LINE: 209
CALL: phpbb\extension\manager->enable_step()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: acp_extensions->main()

FILE: [ROOT]/adm/index.php
LINE: 81
CALL: p_master->load_active()
After which I renamed that (empty looking) module in the ACP and deleted the entry from the database. The extension then enables but throws the errors I mentioned before.

I may have had a version of this extension before, possibly from when it was a david63 extension. I tested quite a few of his through the years :)

Hope you can help!

Thanks!


EDIT: One more thing, when I first enable the extension successfully, this shows in the Customise tab of the ACP:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/symfony/config/Resource/ReflectionClassResource.php on line 139: Use of undefined constant CHAT_STATUS_AVAILABLE - assumed 'CHAT_STATUS_AVAILABLE' (this will throw an Error in a future version of PHP)
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/symfony/config/Resource/ReflectionClassResource.php on line 139: Use of undefined constant CHAT_STATUS_AWAY - assumed 'CHAT_STATUS_AWAY' (this will throw an Error in a future version of PHP)
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/symfony/config/Resource/ReflectionClassResource.php on line 139: Use of undefined constant CHAT_STATUS_BUSY - assumed 'CHAT_STATUS_BUSY' (this will throw an Error in a future version of PHP)
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/symfony/config/Resource/ReflectionClassResource.php on line 139: Use of undefined constant CHAT_STATUS_HIDDEN - assumed 'CHAT_STATUS_HIDDEN' (this will throw an Error in a future version of PHP)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3035)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3035)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3035)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3035)
Ctrl-F5 solves this...

EDIT2:

phpBB 3.3.11
php7.4
Last edited by nou nou on 04 Apr 2024, 14:10, edited 2 times in total.

User avatar
devspace
Owner
Owner
Posts: 284
Joined: October 2022

Re: [3.3.0] Forum Subs

#65

Post by devspace »

Sorry - I missed this as I've been away.

Not sure why you are getting these errors as I cannot reproduce them. Will look into it later.

doublejay
Member
Member
Posts: 5
Joined: November 2023

Re: [3.3.0] Forum Subs

#66

Post by doublejay »

Can you also please check the extension together with PostgreSQL instead of mySQL?

User avatar
devspace
Owner
Owner
Posts: 284
Joined: October 2022

Re: [3.3.0] Forum Subs

#67

Post by devspace »

doublejay wrote: 18 Apr 2024, 21:58
Can you also please check the extension together with PostgreSQL instead of mySQL?
Why - what is the problem?