Problem with tinymce and image uploads

Hi! I’m just getting started in the OJS world, it’s a really amazing tool. First of all I want to thank to PKP and all the community for that.

I’m having an issue with email uploads. Basically when I try to upload an image with tinymce I get a 500 error and these lines in the logs:

[Wed Nov  9 23:43:27 2016] PHP Fatal error:  Call to a member function getContext() on null in /home/migue/Proyectos/ojs/ojs_definitivo/lib/pkp/classes/core/PKPApplication.inc.php on line 253
[Wed Nov  9 23:43:27 2016] 127.0.0.1:37854 [500]: /lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/ci/index.php/upload/english - Call to a member function getContext() on null in /home/migue/Proyectos/ojs/ojs_definitivo/lib/pkp/classes/core/PKPApplication.inc.php on line 253

I also receive exactly the same error and the same error lines if I click into Manage your uploaded images. or if I reload tinymce popup.

I tried several things by now, and non of them worked. It doesn’t seems to be related to permissions, because it’s not trying to access to the disk. Also I tried changing the http server, I first used php development server and then I tried with apache. I even tried in a digital ocean server and I get the same result.

I tried to debug the code, but I’m not very familiarized with php and his tools, so it wasn’t easy for me dig into OJS code.

Hope this is not a repeated question, I searched a good time in this forum and in the old one before let here the question.

Thanks in advance.
Miguel

Hi @hojarasca

You are using the current stable release 2.4.8.1? Where exactly do you try to upload the image? Does this error appears on every TinyMCE?

Hmm… the object $router seems to be null, but I don’t know why…

Best,
Bozana

Thanks for the answer!

I tried with last release of the published in the official page and also with the code cloned from github in tag 2.4.8.1

Yes, it happens in every instance of tinymce.

I tried to debug it a little and I saw what your mention, router is nil. I saw that in the “getRequest” method it enters inside the if clause, so it looks like inside the registry (I don’t know exactly what the registry is, but it looks like something that share state inside the hole request)
the “request” object is also null, so it’s using some kind of “default request”, and that request is created with a null router.

That was all that I was able to find with my rudimentary php knowledge.

Any hint is useful for me, even a hint to improve debugging, right now my only tool to debug is “error_log” function.

Thanks in advance!

I had the same problem, the solution is very simple: delete the cookies. :wink: