Skip to content

Commit eee47db

Browse files
authored
Merge pull request #264 from iMattPro/updates
Fix mysqli error in PHP 8.1 Plus other updates
2 parents fe6ba25 + d04259b commit eee47db

File tree

12 files changed

+1144
-708
lines changed

12 files changed

+1144
-708
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
## Version 1.6.3
3333
- [Fix] Fixed a problem where boards would not populate when using PHP 8.
3434
- [Fix] Clarified how the option to install additional styles should be used.
35-
- [Fix] Fixed an issue where “Additional board config settings would be ignored if they tried to set a config to a value of 0, false or an empty string.
35+
- [Fix] Fixed an issue where “Additional board config settings would be ignored if they tried to set a config to a value of 0, false or an empty string.
3636
- [Fix] Fixed a few more issues in the code base which could pose problems with future versions of PHP and phpBB.
3737
- [Change] Small internal change to QI's SCSS file, moved away from using division to avoid issues with SASS 1.33.
3838

@@ -64,8 +64,8 @@
6464
- [Change] Populated users will now have a last active date.
6565
- [Change] Enforce email domain requirement for populated users.
6666
- [Change] QI’s TWIG templates can now support language substitution variables.
67-
- [Change] Moved “Install additional styles” option on main page to the “Install options” sub-section.
68-
- [Change] Show the admin name and password in their respective fields in the “Install options” sub-section.
67+
- [Change] Moved “Install additional styles” option on main page to the “Install options” subsection.
68+
- [Change] Show the admin name and password in their respective fields in the “Install options” subsection.
6969
- [Fix] Fixed potential PHP 8 issues (Issues #157, #160, #162).
7070
- [Fix] Fixed invalid HTML issues.
7171

@@ -285,7 +285,7 @@
285285
- [Fix] Ticket #63305 `$language` was null when sent as default to request_var.
286286
- [Fix] Ticket #63306 QI needs to correctly handle an empty qi_config.cfg.
287287
- [Change] Added checking for functions_mods.php. It will be moved in AutoMOD in the future.
288-
- [Change] Include functions_admin.php for postgres' benefit.
288+
- [Change] Include functions_admin.php for postgres benefit.
289289
- [Change] Use `get_cache_dir()` in sqlite dbal.
290290
- [Change] Delay database connection until it is necessary.
291291
- [Change] Cleaned up the JS in the main html file.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ QuickInstall is designed to run on all modern browsers. Please don't use old stu
4040
##### phpBB Requirements
4141
phpBB boards require a web server running PHP and one of the following database management systems.
4242

43-
| phpBB | PHP | MySQL | MariaDB | PostgreSQL | SQLite | MS SQL |
44-
| -------------- | ------------- |------- |-------- |----------- |--------------- |------------- |
45-
| 4.0.x (alpha) | 7.3.0 - 8.x | 4.1.3+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
46-
| 3.3.x | 7.1.3 - 8.x | 4.1.3+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
47-
| 3.2.2 - 3.2.x | 5.4.7 - 7.2.x | 3.23+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
48-
| 3.2.0 - 3.2.1 | 5.4.7 - 7.1.x | 3.23+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
49-
| 3.1.x | 5.4.7 - 5.6.x | 3.23+ | 5.1+ | 8.3+ | SQLite 2 or 3 | Server 2000+ |
50-
| 3.0.x | 5.4.7 - 5.6.x | 3.23+ | - | 7.x | SQLite 2 | Server 2000 |
43+
| phpBB | PHP | MySQL | MariaDB | PostgreSQL | SQLite | MS SQL |
44+
|---------------|---------------|--------|---------|------------|----------------|--------------|
45+
| 4.0.x (alpha) | 7.3.0 - 8.x | 4.1.3+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
46+
| 3.3.x | 7.1.3 - 8.x | 4.1.3+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
47+
| 3.2.2 - 3.2.x | 5.4.7 - 7.2.x | 3.23+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
48+
| 3.2.0 - 3.2.1 | 5.4.7 - 7.1.x | 3.23+ | 5.1+ | 8.3+ | SQLite 3.6.15+ | Server 2000+ |
49+
| 3.1.x | 5.4.7 - 5.6.x | 3.23+ | 5.1+ | 8.3+ | SQLite 2 or 3 | Server 2000+ |
50+
| 3.0.x | 5.4.7 - 5.6.x | 3.23+ | - | 7.x | SQLite 2 | Server 2000 |
5151

5252
## 🐞 Support
5353
You can receive support at the [phpBB3 QuickInstall Discussion/Support](https://www.phpbb.com/customise/db/official_tool/phpbb3_quickinstall/support) forum.

includes/db/mysqli.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ class dbal_mysqli_qi extends \phpbb\db\driver\mysqli
2626
*/
2727
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
2828
{
29+
/*
30+
* As of PHP 8.1 MySQLi default error mode is set to MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT
31+
* See https://wiki.php.net/rfc/mysqli_default_errmode
32+
* Since phpBB implements own SQL errors handling, explicitly set it back to MYSQLI_REPORT_OFF
33+
*/
34+
if (PHP_VERSION_ID >= 80100)
35+
{
36+
@mysqli_report(MYSQLI_REPORT_OFF);
37+
}
38+
2939
$this->persistency = $persistency;
3040
$this->user = $sqluser;
3141
$this->server = $sqlserver;
@@ -34,7 +44,7 @@ public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port
3444

3545
$this->sql_layer = 'mysql_41';
3646

37-
// Persistant connections not supported by the mysqli extension?
47+
// Persistent connections not supported by the mysqli extension?
3848
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, null, $port);
3949

4050
if ($this->db_connect_id)

includes/qi_populate.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ private function save_users()
649649
$newly_registered_group = (int) array_search('NEWLY_REGISTERED', $user_groups, true);
650650

651651
$s_chunks = $this->num_users > $this->user_chunks;
652-
$end = $this->num_users + 1;
653652
$chunk_cnt = 0;
654653
$sql_ary = array();
655654

@@ -745,6 +744,7 @@ private function save_users()
745744

746745
$skip--;
747746

747+
$chunk_cnt++;
748748
if ($s_chunks && $chunk_cnt >= $this->user_chunks)
749749
{
750750
// throw the array to the users table
@@ -754,7 +754,11 @@ private function save_users()
754754
$chunk_cnt = 0;
755755
}
756756
}
757-
$db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary);
757+
// If there are any remaining users we need to throw them in too.
758+
if (!empty($sql_ary))
759+
{
760+
$db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary);
761+
}
758762

759763
// Get the last user
760764
$user = end($this->user_arr);

0 commit comments

Comments
 (0)