Page 1 of 1

phpBB 3.2 does not handle different auto increments correctly

Posted: Thu Apr 27, 2017 10:01 am
by Kigen
OS: Ubuntu 16.04
PHP: PHP-FPM 7.0 (Ubuntu package)
HTTPD: Apache 2.4 (Ubuntu package)
SQL: MariaDB 10.1 (latest from MariaDB repo) with Galera Clustering (yes, I am using clustering)

Code: Select all

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

SELECT * FROM phpbb_styles s WHERE s.style_id = 

in file /**removed**/public_html/phpBB32/phpbb/db/driver/driver.php on line 999

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: installer_msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 999
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/user.php
LINE: 264
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/phpbb/install/module/install_finish/task/install_extensions.php
LINE: 103
CALL: phpbb\user->setup()

FILE: [ROOT]/phpbb/install/module_base.php
LINE: 149
CALL: phpbb\install\module\install_finish\task\install_extensions->run()

FILE: [ROOT]/phpbb/install/installer.php
LINE: 219
CALL: phpbb\install\module_base->run()

FILE: [ROOT]/phpbb/install/controller/install.php
LINE: 133
CALL: phpbb\install\installer->run()

FILE: (not given by php)
LINE: (not given by php)
CALL: phpbb\install\controller\install->phpbb\install\controller\{closure}()

FILE: [ROOT]/vendor/symfony/http-foundation/StreamedResponse.php
LINE: 113
CALL: call_user_func()

FILE: [ROOT]/vendor/symfony/http-foundation/Response.php
LINE: 374
CALL: Symfony\Component\HttpFoundation\StreamedResponse->sendContent()

FILE: [ROOT]/install/app.php
LINE: 57
CALL: Symfony\Component\HttpFoundation\Response->send()
It seems the installer doesn't like something about my setup which results in it not getting the default style that does exist in the database in phpbb_styles. The prosilver row gets given style_id 4.

I'm currently just attempting to do an install. Ultimately I'm actually trying to upgrade a very old board (phpBB 2) to the latest. But since a fresh install is needed before doing a conversion I've gotten stuck at that part.

This error seems to be coming from /phpbb/user.php:264 having an empty $style_id.

p.s., There are working pbpBB 3.2 forums on this same machine but they were not installed on this machine.

Edit: The issue
This is caused by auto increment not working in ways /install/schemas/schema_data.sql expects. phpBB should not be relying on auto increment being by 1. As this obviously breaks cluster compatibility. As the auto increment variables cannot be set in a cluster environment. However, a lot of this file expects this behavior when it shouldn't. And more importantly constants.php expects ANONYMOUS to be user_id 1 without explicitly setting it. So I'm now going through this file and explicitly setting the ID numbers.

Edit2: Temporary solution
Manually setting the IDs in schema_data.sql works. The board successfully installed with them all manually set but this is not the best solution. As different database solutions handle this type of situation differently. In my case, MariaDB/MySQL allows easy setting of the ID during the INSERT query. However, other solutions such as MSSQL do not like this as well. But MSSQL simply overwrites any ID set without any notification. Ideally the data insertion should not assume the ID of whatever it relies on. Instead it should do INSERT SELECT if needed. I will see about submitting a permanent solution soon. Here is the temporary solution since I cannot upload .sql or .zip to this board. Schema Data ZIP with IDs set.