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

Plural translations whe not logged #2949

Closed
trasher opened this issue Oct 11, 2017 · 0 comments
Closed

Plural translations whe not logged #2949

trasher opened this issue Oct 11, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@trasher
Copy link
Contributor

trasher commented Oct 11, 2017

Running a custom script from command line; we get the following error:

Fatal error: Uncaught Error: Call to a member function translatePlural() on null in /var/www/glpi/inc/autoload.function.php:171
Stack trace:
#0 /var/www/glpi/inc/notepad.class.php(171): _n('Note', 'Notes', 2)
#1 /var/www/glpi/inc/computer.class.php(881): Notepad::getSearchOptionsToAdd()
#2 /var/www/glpi/inc/search.class.php(5382): Computer->getSearchOptions()
#3 /var/www/glpi/inc/log.class.php(124): Search::getOptions('Computer')
#4 /var/www/glpi/inc/commondbtm.class.php(381): Log::constructHistory(Object(Infocom), Array, Array)
#5 /var/www/glpi/inc/commondbtm.class.php(1146): CommonDBTM->updateInDB(Array, Array)
#6 /path/to/scrpit.php(1234): CommonDBTM->update(Array)
#7 {main}
  thrown in /var/www/glpi/inc/autoload.function.php on line 171

Problem is $TRANSLATION variable is only set once logged in. There is a fallback for the __() method, but not for _n().

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

1 participant