I’m upgrading from OJS 2.4.8-5 to 3.2.1-4, with the intention of then upgrading to 3.3.
Under Installer::setFileName I’m getting unserialize errors. There are no significant errors before this point apart from some missing PDFs from the file system.
…
[code: Installer Installer::setStatsEmailSettings]
[code: Installer Installer::fixLibraryFiles]
[code: Installer Installer::installEmailTemplate]
[note: docs/release-notes/README-3.2.0]
[code: Installer Installer::setFileName]
PHP Notice: unserialize(): Error at offset 0 of 29 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 357
…
This PHP notice repeats quite a few times.
I patched DAO.inc.php to tell me what the value is when unserialize fails.
--- a/classes/db/DAO.inc.php
+++ b/classes/db/DAO.inc.php
@@ -354,7 +354,13 @@ class DAO {
break;
case 'object':
case 'array':
- $value = unserialize($value);
+ $v2 = unserialize($value);
+ if (is_bool($v2) && !$v2) {
+ trigger_error("Failed to convert from DB: ${value}");
+ $value = null;
+ } else {
+ $value = $v2;
+ }
break;
case 'date':
if ($value !== null) $value = strtotime($value);
The upgrade log them became (after removing duplicate pairs of lines).
…
[code: Installer Installer::setFileName]
PHP Notice: unserialize(): Error at offset 0 of 29 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 357
PHP Notice: Failed to convert from DB: cover_article_11330_en_US.jpg in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 359
…
PHP Notice: unserialize(): Error at offset 0 of 29 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 357
PHP Notice: Failed to convert from DB: cover_article_13158_en_US.png in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 359
…
PHP Notice: unserialize(): Error at offset 0 of 29 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 357
PHP Notice: Failed to convert from DB: cover_article_13943_en_US.png in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 359
…
All of the $value
s that couldn’t be unserialized are these simple strings about cover images.
Having already fixed quite a lot of data issues already, I thought “I know what this is! The setting type will be object or array instead string”. Alas, it’s not.
I searched a text dump of the my OJS database for these strings, and the only place they turned up in was as values for article fileName settings.
+------------+--------+--------------+-------------------------------+--------------+
| article_id | locale | setting_name | setting_value | setting_type |
+------------+--------+--------------+-------------------------------+--------------+
| 8325 | en_US | fileName | cover_article_8325_en_US.jpg | string |
| 9045 | en_US | fileName | cover_article_9045_en_US.jpg | string |
| 9065 | en_US | fileName | cover_article_9065_en_US.jpg | string |
| 9066 | en_US | fileName | cover_article_9066_en_US.jpg | string |
| 9067 | en_US | fileName | cover_article_9067_en_US.jpg | string |
| 9068 | en_US | fileName | cover_article_9068_en_US.jpg | string |
| 9069 | en_US | fileName | cover_article_9069_en_US.jpg | string |
| 9115 | en_US | fileName | cover_article_9115_en_US.jpg | string |
…
+------------+--------+--------------+-------------------------------+--------------+
Every fileName value in this table is mentioned in the logs as not being able to be unserialized.
Given the setting_type is string, I don’t understand how I’m even getting to this point in the code where it is trying to be unserialized. And so I don’t know what my next step is.