OJS 3.0.2 - Fatal error - getUserVar() on null

Hi!

I’am dealing with a strange error on a OJS instance, 3.0.2 with the following output:

Fatal error: Call to a member function getUserVar() on null in /home/account/urlofjournal.com/classes/i18n/AppLocale.inc.php on line 75

Nothing on logs…

Any clue on what is causing this error ?

Regards,

José Carvalho

Hi @josekarvalho,

Can you turn on show_stacktrace in config.inc.php and post the result?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Everything is on:

[debug]

; Display a stack trace when a fatal error occurs.
; Note that this may expose private information and should be disabled
; for any production system.
show_stacktrace = On

; Display an error message when something goes wrong.
display_errors = On

; Display deprecation warnings
deprecation_warnings = On

; Log web service request information for debugging
log_web_service_info = On

When activating the debug of database I have this:

(mysqli): SELECT * FROM sessions WHERE session_id = ‘-3RhYQFM20SOq7EFxDQhT2’

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/account/urlofjournal.com/lib/pkp/lib/adodb/adodb.inc.php:519) in /home/account/urlofjournal.com/lib/pkp/classes/session/SessionManager.inc.php on line 59

Fatal error: Call to a member function getUserVar() on null in /home/account/urlofjournal.com/classes/i18n/AppLocale.inc.php on line 75
(mysqli): UPDATE sessions SET user_id = NULL, ip_address = ‘9X.XXX.XX.XX7’, user_agent = ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30’, created = 1491245561, last_used = 1491245998, remember = 0, data = ‘’, domain = ‘www.urlofjournal.com’ WHERE session_id = ‘-3RhYQFM20SOq7EFxDQhT2’

and nothing else…

I get back 3 versions of the database and get always the same issue.

The actions I made before this was importing users (XML user import) and change their groups directly on database, but after that everything was ok, later this error appears…

Thanks,

José Carvalho

Hi @josekarvalho,

Hmm, I’m not sure why the full stack trace isn’t appearing. Does this message appear on one specific page, or all of them? Have you recently made changes e.g. installing plugins?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I remember that I activate new available plugins (some of them only) but didn’t test. the translation, coins, etc… but not external plugins.

I have check on database “plugin_settings” and put them with “enable” → setting_value = 0 for context ID 1 in this case (that should corresponds to the only journal installed).

but it continues with the same error. Also tried to access another page and the error is the same (archive, login,…)

Regards,

José Carvalho

@asmecher, another update… just try to connect a test instance of OJS with the existing database and it works well, so I suppose the problem is external to OJS … :angry: will try to figure what is the problem… and give feedback!

Just to update the situation…

1 - Changed the folder on the hosting service (to avoid possible misconfigurations on the server side)
2 - Put new files from the source code of 3.0.2

And everything was ok… so the conclusion is that the initial code could have some errors or be corrupted (even if I made wget from the PKP website regarding the tar file), probably related to some configurations on the server side…

Hi @josekarvalho,

Thanks for following up – the standard diff tool is useful in identifying changes in situations like this, just FYI!

Regards,
Alec Smecher
Public Knowledge Project Team

I’m having the same issue. It only occurs when I try to activate the config property:
web_cache = On

On classes/i18n/AppLocale->getLocale(), the request is null
$locale = self::$request->getUserVar('uiLocale');

I can only get it to work if I return earlier

if (self::$request == null) {
   return $currentLocale;
}

Do you know why self::$request is null?

1 Like

Thank you, I lost a day trying to find whats is wrong. I had 500 error on db pages and same mistake with debug on.