Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from 3.2 to last 3.3.0-19 crashes due wrong type in substr(): Argument #3 #10445

Closed
marcbria opened this issue Sep 18, 2024 · 4 comments
Assignees
Milestone

Comments

@marcbria
Copy link
Collaborator

marcbria commented Sep 18, 2024

Describe the bug
When I upgrade from stable-3.2 to stable-3.3 (3.3.0-19) I got the following error:

2024-09-18 13:42:09 [migration: OJSv3_3_0UpgradeMigration]
PHP Fatal error:  Uncaught TypeError: substr(): Argument #3 ($length) must be of type ?int, string given in /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php:181
Stack trace:
#0 /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php(181): substr()
#1 /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php(120): OJSv3_3_0UpgradeMigration->_toJSON()
#2 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php(202): OJSv3_3_0UpgradeMigration->{closure}()
#3 /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php(121): Illuminate\Support\Collection->each()
#4 /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php(37): OJSv3_3_0UpgradeMigration->_settingsAsJSON()
#5 /var/www/html/lib/pkp/classes/install/Installer.inc.php(406): OJSv3_3_0UpgradeMigration->up()
#6 /var/www/html/lib/pkp/classes/install/Installer.inc.php(252): Installer->executeAction()
#7 /var/www/html/lib/pkp/classes/install/Installer.inc.php(175): Installer->executeInstaller()
#8 /var/www/html/lib/pkp/classes/cliTool/UpgradeTool.inc.php(89): Installer->execute()
#9 /var/www/html/lib/pkp/classes/cliTool/UpgradeTool.inc.php(65): UpgradeTool->upgrade()
#10 /var/www/html/tools/upgrade.php(22): UpgradeTool->execute()
#11 {main}
  thrown in /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php on line 181

After this, the upgrade exits and the system is unusable.

What application are you using?
Dockerized OJS 3.2.1-4 > 3.3.0-19.

Additional information

I tested it with multiple journals (from same origin and destination versions) and upgrade crashes with all of them.
If I upgrade to 3.3.0-18, upgrade finishes but a different error is shown (posted in #9953)... so looks like this is an issue introduced in -19.
If I upgrade to 3.3.0-17, all works as expected so then you can upgrade to 3.3.0-19 without any trouble (but it's not a workaround because in -17 the data of the reviewer's form is mixed as documented in #9953).

If you can't reproduce the issue with the standard "datasets", I can provide a DB dump.

@asmecher
Copy link
Member

This was introduced with pkp/ojs#4379 -- the call to substr looks to be incorrect, and newer versions of PHP are cashing due to a type mismatch. @jonasraoni, can you have a look?

@asmecher asmecher added this to the 3.3.0-20 milestone Sep 18, 2024
asmecher added a commit to pkp/ojs that referenced this issue Sep 18, 2024
asmecher added a commit that referenced this issue Sep 18, 2024
@asmecher asmecher assigned asmecher and unassigned jonasraoni Sep 18, 2024
@asmecher
Copy link
Member

The following patches should correct it:

@marcbria, I've added these directly to stable-3_3_0 and stable-3_4_0. If you can confirm that they resolve the error message, that will help!

asmecher added a commit that referenced this issue Sep 18, 2024
@marcbria
Copy link
Collaborator Author

Wow... that was fast. :-)
I will test it tomorrow morning!
Thanks Alec and Jonas.

@marcbria
Copy link
Collaborator Author

marcbria commented Sep 19, 2024

Initial error disappears, but I got a new one (and upgrade still exits without success).

2024-09-19 07:54:04 [migration: OJSv3_3_0UpgradeMigration]
PHP Warning:  Undefined property: stdClass::$locale in /var/www/html/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php on line 191
ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'where clause' (SQL: update `deleted_plugin_settings` set `setting_value` = ["Editor","Indexacio"] where `setting_name` = blocks and `locale` is null and `context_id` = 1)

Do you want me to open a new issue or you prefer talking here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants