Skip to content

[Bug] | OJS 3.5.0 Upgrade Fails with SQL Syntax Error 1064 on MariaDB/MySQL due to Incorrect Default Value Quoting #11529

@thuanhuynhh

Description

@thuanhuynhh

Valid Title

  • I have updated the title to accurately reflect the bug description

Description

When upgrading from OJS 3.4.0.9 to OJS 3.5.0 on my server using MariaDB, the process error with a PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064. The error is caused by the migration script I9425_SeparateUIAndSubmissionLocales.php, which incorrectly generates an ALTER TABLE statement. It reads an existing default value for a locale column (e.g., 'en') and wraps it in an additional set of quotes, resulting in an invalid SQL syntax (DEFAULT ''en'' instead of the correct DEFAULT 'en').

Steps to Reproduce

  1. Run upgrade tool: php tools/upgrade.php upgrade.

Expected Result

Skip this bug and the process should complete successfully

Actual Result

`ERROR: Upgrade failed: DB: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 1 in /home/jha-demo/htdocs/demo.jha.vn/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:565
Stack trace:
#0 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(565): PDO->prepare()
#1 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(812): Illuminate\Database\Connection->Illuminate\Database{closure}()
#2 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\Database\Connection->runQueryCallback()
#3 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\Database\Connection->run()
#4 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(118): Illuminate\Database\Connection->statement()
#5 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(564): Illuminate\Database\Schema\Blueprint->build()
#6 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(406): Illuminate\Database\Schema\Builder->build()
#7 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(361): Illuminate\Database\Schema\Builder->table()
#8 /home/lib/pkp/classes/migration/upgrade/v3_5_0/I9425_SeparateUIAndSubmissionLocales.php(115): Illuminate\Support\Facades\Facade::__callStatic()
#9 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(261): PKP\migration\upgrade\v3_5_0\I9425_SeparateUIAndSubmissionLocales->PKP\migration\upgrade\v3_5_0{closure}()
#10 /home/lib/pkp/classes/migration/upgrade/v3_5_0/I9425_SeparateUIAndSubmissionLocales.php(107): Illuminate\Support\Collection->each()
#11 /home/lib/pkp/classes/install/Installer.php(445): PKP\migration\upgrade\v3_5_0\I9425_SeparateUIAndSubmissionLocales->up()
#12 /home/lib/pkp/classes/install/Installer.php(298): PKP\install\Installer->executeAction()
#13 /home/lib/pkp/classes/install/Installer.php(207): PKP\install\Installer->executeInstaller()
#14 /home/lib/pkp/classes/cliTool/UpgradeTool.php(97): PKP\install\Installer->execute()
#15 /home/lib/pkp/classes/cliTool/UpgradeTool.php(70): PKP\cliTool\UpgradeTool->upgrade()
#16 /home/tools/upgrade.php(22): PKP\cliTool\UpgradeTool->execute()
#17 {main}

Next Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 1 (Connection: mysql, SQL: alter table email_templates_default_data modify locale varchar(28) not null default ''en'') in /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
Stack trace:
#0 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\Database\Connection->runQueryCallback()
#1 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\Database\Connection->run()
#2 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(118): Illuminate\Database\Connection->statement()
#3 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(564): Illuminate\Database\Schema\Blueprint->build()
#4 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(406): Illuminate\Database\Schema\Builder->build()
#5 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(361): Illuminate\Database\Schema\Builder->table()
#6 /home/lib/pkp/classes/migration/upgrade/v3_5_0/I9425_SeparateUIAndSubmissionLocales.php(115): Illuminate\Support\Facades\Facade::__callStatic()
#7 /home/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(261): PKP\migration\upgrade\v3_5_0\I9425_SeparateUIAndSubmissionLocales->PKP\migration\upgrade\v3_5_0{closure}()
#8 /home/lib/pkp/classes/migration/upgrade/v3_5_0/I9425_SeparateUIAndSubmissionLocales.php(107): Illuminate\Support\Collection->each()
#9 /home/lib/pkp/classes/install/Installer.php(445): PKP\migration\upgrade\v3_5_0\I9425_SeparateUIAndSubmissionLocales->up()
#10 /home/lib/pkp/classes/install/Installer.php(298): PKP\install\Installer->executeAction()
#11 /home/lib/pkp/classes/install/Installer.php(207): PKP\install\Installer->executeInstaller()
#12 /home/lib/pkp/classes/cliTool/UpgradeTool.php(97): PKP\install\Installer->execute()
#13 /home/lib/pkp/classes/cliTool/UpgradeTool.php(70): PKP\cliTool\UpgradeTool->upgrade()
#14 /home/tools/upgrade.php(22): PKP\cliTool\UpgradeTool->execute()
#15 {main}`

Environment Details

No response

Application Version

3.5.0.0

Logs

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Bug:1:MinorA bug found in uncommon paths, with low consequences, limited users or has an easy workaround

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions