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

Database upgrade from 0.84.4 to 9.1.6 failed #2558

Closed
C-Duv opened this issue Aug 5, 2017 · 13 comments
Closed

Database upgrade from 0.84.4 to 9.1.6 failed #2558

C-Duv opened this issue Aug 5, 2017 · 13 comments
Labels

Comments

@C-Duv
Copy link
Contributor

C-Duv commented Aug 5, 2017

I got a PHP error when trying to update my GLPI instance from version 0.84.4 to version 9.1.6, error occured during database upgrade to version 9.1:

Fatal error: Uncaught exception 'Zend\I18n\Exception\OutOfBoundsException' with message 'Provided index 1 does not exist in plural array'

What I did

  • Disabled all plugins
  • Created new directory where to extract v9.1.6 .tgz file
  • Copied data files from old 0.84.4 instance to new 9.1.6 instance:
    cd ${path_to_new_glpi}
    cp -Ra ${path_to_old_glpi}/files/[!_]* ./files/
    cp -Ra --no-clobber ${path_to_old_glpi}/files/_plugins ./files/
    cp -Ra --no-clobber ${path_to_old_glpi}/plugins/* ./plugins/
  • Opened GLPI's URL.
  • Chose language, accepted licence and chose "Update".
  • All internal auto-tests were OK but the IMAP extension one because this extensions is not enabled on my system.
  • Gave database information and chose database.
  • Confirmed to run the database upgrade.

What I got

GLPI SETUP

Upgrade

Database connection successful
Work in progress...

Update to 0.84.6
Task completed. (0 seconds)

Update to 0.85
Task completed. (3 seconds)

Update to 0.85.3
Task completed. (4 seconds)

Update to 0.85.5
Task completed. (4 seconds)

Update to 0.90
Task completed. (4 seconds)

Update to 0.90.1
Task completed. (4 seconds)

Update to 0.90.5
Task completed. (4 seconds)

Update to 9.1
Change of the database layout - glpi_networkportfiberchannels (7 seconds)

Fatal error: Uncaught exception 'Zend\I18n\Exception\OutOfBoundsException' with message 'Provided index 1 does not exist in plural array' in /path_to_glpi/vendor/zendframework/zend-i18n/src/Translator/Translator.php:413
Stack trace:
#0 /path_to_glpi/inc/autoload.function.php(171): Zend\I18n\Translator\Translator->translatePlural('Associated elem...', 'Associated elem...', 2, 'glpi')
#1 /path_to_glpi/inc/ticket.class.php(2417): _n('Associated elem...', 'Associated elem...', 2)
#2 /path_to_glpi/inc/search.class.php(5391): Ticket->getSearchOptions()
#3 /path_to_glpi/install/update_0905_91.php(469): Search::getOptions('Ticket')
#4 /path_to_glpi/install/update.php(795): update0905to91()
#5 /path_to_glpi/install/update.php(966): updateDbUpTo031()
#6 {main} thrown in /path_to_glpi/vendor/zendframework/zend-i18n/src/Translator/Translator.php on line 413

I gave it a second try by re-opening GLPI's URL:

I got the "Internal auto-tests page" which displayed this message and the Upgrade button:

The version of the database is not compatible with the version of the installed files. An update is necessary.

Then the same PHP error:

GLPI SETUP

Upgrade

Database connection successful
Work in progress...

Update to 0.85.3
Task completed. (0 seconds)

Update to 0.85.5
Task completed. (0 seconds)

Update to 0.90
Task completed. (0 seconds)

Update to 0.90.1
Task completed. (0 seconds)

Update to 0.90.5
Task completed. (0 seconds)

Update to 9.1
date_mod and date_creation (0 seconds)

Fatal error: Uncaught exception 'Zend\I18n\Exception\OutOfBoundsException' with message 'Provided index 1 does not exist in plural array' in /path_to_glpi/vendor/zendframework/zend-i18n/src/Translator/Translator.php:413
Stack trace:
#0 /path_to_glpi/inc/autoload.function.php(171): Zend\I18n\Translator\Translator->translatePlural('Associated elem...', 'Associated elem...', 2, 'glpi')
#1 /path_to_glpi/inc/ticket.class.php(2417): _n('Associated elem...', 'Associated elem...', 2)
#2 /path_to_glpi/inc/search.class.php(5391): Ticket->getSearchOptions()
#3 /path_to_glpi/install/update_0905_91.php(469): Search::getOptions('Ticket')
#4 /path_to_glpi/install/update.php(795): update0905to91()
#5 /path_to_glpi/install/update.php(966): updateDbUpTo031()
#6 {main} thrown in /path_to_glpi/vendor/zendframework/zend-i18n/src/Translator/Translator.php on line 413

I noticed it started at a higher version of the database than try number 1 and errored on a different message so I gave it a third try: got the exact same output than try number 2.

Environment

PHP v5.6.30
MySQL v5.5.57
Apache v2.4.10

@C-Duv
Copy link
Contributor Author

C-Duv commented Aug 5, 2017

Some googling led me to #1040 but file files/_log/php-errors.log only contains lines with "Test".

Error seemed to come from a missing translation ID (Associated element or Associated elements), but I checked and they are indeed in the .po file I use (fr_FR.po).

What I forgot to say is that I run the Zend OPcache extension (v7.0.6) which made me think of something...
After a simple restart of Apache, I gave the database upgrade another try and it went through without any error.

I can't see what you guys can do about it...
Maybe detect if the OPcache extension is enabled and try to run opcache_invalidate() or opcache_reset()?
Or at least, if a fatal error occurs, display to the user, an hint about clearing OPcache's cache or restarting Apache/PHP-FPM (depending on the SAPI used) and re-running the upgrade process.

Let's hope anyone getting the same issue will find this page and be able to resolve his with the same solution.

@trasher
Copy link
Contributor

trasher commented Aug 7, 2017

I guess translations are handled with APCu; but the problem is similar; cache may sometimes breaks on upgrade; should be fixed anyways

@trasher trasher added the bug label Aug 7, 2017
@trasher trasher added this to the 9.1.7 milestone Aug 7, 2017
trasher added a commit to trasher/glpi that referenced this issue Aug 8, 2017
@trasher
Copy link
Contributor

trasher commented Aug 8, 2017

Could you try with trasher@caa559b please?

@C-Duv
Copy link
Contributor Author

C-Duv commented Aug 8, 2017

I'll try to remount my old v0.84.4 instance on a VM and update it to trasher/glpi@caa559b.
Unless you have a better why to test it?

@trasher
Copy link
Contributor

trasher commented Aug 9, 2017

@C-Duv hum... No, I think this is the best way to go ;)

@trasher
Copy link
Contributor

trasher commented Aug 10, 2017

@gaionim this is not related to the current issue

@gaionim
Copy link

gaionim commented Aug 10, 2017

I know, but for upgrade successfully from 0.84.4 to 9.1.6 is still necessary modify update_91_911.php
or I'm wrong?
Worth I open a new issue ?

@trasher
Copy link
Contributor

trasher commented Aug 10, 2017

Please open an new issue; yes :)

@trasher
Copy link
Contributor

trasher commented Aug 10, 2017

An issue already exists (linked from forum); see #1296

@gaionim
Copy link

gaionim commented Aug 10, 2017

ok, thanks

@C-Duv
Copy link
Contributor Author

C-Duv commented Aug 24, 2017

I failed to reproduce the issue (before applying the fix) :(

But once the trasher/glpi@caa559b fix is applied I get:

PHP Notice: Undefined variable: TRANSLATE in /var/www/html/glpi/9.1.6/install/update.php at line 119

Fatal error: Call to a member function clearCache() on null in /var/www/html/glpi/9.1.6/install/update.php on line 119

Also, it seems clearCache()is not existing inZend\I18n\Translator\Translator.

@trasher
Copy link
Contributor

trasher commented Aug 29, 2017

OK... I'm not going to fix anything since I'm not sure this will fix the original issue.

@trasher trasher removed this from the 9.1.7 milestone Aug 29, 2017
@trasher trasher closed this as completed Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants