Skip to content

Plugin with "verb=settings" gives "Failed Ajax request or invalid JSON returned" #8064

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

Closed
marlara opened this issue Jul 4, 2022 · 14 comments
Assignees

Comments

@marlara
Copy link

marlara commented Jul 4, 2022

Describe the bug
Installing plugings that calls for an API with "verb=settings" gives no possibilities to configure it, see also: https://forum.pkp.sfu.ca/t/error-when-configuring-texteditor-extras-3-3-0-11/73666

To Reproduce
Steps to reproduce the behavior:

  1. Install a plugin like Text-editor-extras
  2. Click on "Configure"
  3. See error

What application are you using?
OJS 3.3.0.11

Additional information
PHP version: 8.1 (but it appears also with PHP 8.0).
Multi-site installation with custom domains.
The JSON is actually completely empty, that's why there is the invalid JSON returned, but every call without the "verb=settings" works fine.
EDIT: I installed the plugin directly from the Plugin Gallery

asmecher added a commit to pkp/textEditorExtras that referenced this issue Jul 6, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
erictapen Kerstin
@asmecher
Copy link
Member

asmecher commented Jul 6, 2022

@marlara, the clue was the error log entry you posted in the forum:

PHP Fatal error: Declaration of TextEditorExtrasSettingsForm::execute() must be compatible with Form::execute(…$functionArgs) in /var/www/ojs/plugins/generic/textEditorExtras/TextEditorExtrasSettingsForm.inc.php on line 65, referer: https://journals.com/

You can resolve it by applying this change to the text editor plugin: pkp/textEditorExtras@46b8a7a

Similar errors may exist in other plugins but they'll need to be resolved separately; please file them as additional issues.

@asmecher asmecher closed this as completed Jul 6, 2022
@asmecher asmecher self-assigned this Jul 6, 2022
@marlara
Copy link
Author

marlara commented Jul 7, 2022

Unfortunately even with the change it gives the Ajax error.

I have this errors now:

[Thu Jul 07 00:03:40.560606 2022] [php:error] [pid 2360052] [client 134.209.159.97:50176] script '/var/www/ojs/system_api.php' not found or unable to stat
[Thu Jul 07 00:03:41.849176 2022] [php:error] [pid 2360053] [client 134.209.159.97:38786] script '/var/www/ojs/system_api.php' not found or unable to stat
[Thu Jul 07 00:13:20.970079 2022] [php:error] [pid 2360051] [client 34.105.17.129:45886] script '/var/www/ojs/wp-login.php' not found or unable to stat
[Thu Jul 07 07:57:21.829584 2022] [authz_core:error] [pid 2362685] [client 109.74.204.123:54358] AH01630: client denied by server configuration: /var/www/ojs/server-status
[Thu Jul 07 07:57:22.158715 2022] [authz_core:error] [pid 2362684] [client 109.74.204.123:13015] AH01630: client denied by server configuration: /var/www/ojs/server-status
[Thu Jul 07 07:57:25.924136 2022] [php:error] [pid 2362684] [client 109.74.204.123:23704] script '/var/www/ojs/localstart.php' not found or unable to stat
[Thu Jul 07 07:57:26.295514 2022] [php:error] [pid 2362687] [client 109.74.204.123:48882] script '/var/www/ojs/localstart.php' not found or unable to stat
[Thu Jul 07 07:57:30.765305 2022] [php:error] [pid 2360084] [client 109.74.204.123:37696] script '/var/www/ojs/admin.php' not found or unable to stat
[Thu Jul 07 07:57:31.186639 2022] [php:error] [pid 2360470] [client 109.74.204.123:6363] script '/var/www/ojs/admin.php' not found or unable to stat
[Thu Jul 07 07:57:31.976662 2022] [php:error] [pid 2362685] [client 109.74.204.123:64747] script '/var/www/ojs/default.php' not found or unable to stat
[Thu Jul 07 07:57:32.403209 2022] [php:error] [pid 2362687] [client 109.74.204.123:26494] script '/var/www/ojs/default.php' not found or unable to stat
[Thu Jul 07 07:57:33.999187 2022] [php:error] [pid 2362684] [client 109.74.204.123:29722] script '/var/www/ojs/start.php' not found or unable to stat
[Thu Jul 07 07:57:34.269435 2022] [php:error] [pid 2360085] [client 109.74.204.123:39832] script '/var/www/ojs/start.php' not found or unable to stat
[Thu Jul 07 07:57:34.543016 2022] [php:error] [pid 2360051] [client 109.74.204.123:47676] script '/var/www/ojs/indice.php' not found or unable to stat
[Thu Jul 07 07:57:34.999429 2022] [php:error] [pid 2362684] [client 109.74.204.123:38591] script '/var/www/ojs/main.php' not found or unable to stat
[Thu Jul 07 07:57:35.089854 2022] [php:error] [pid 2360050] [client 109.74.204.123:33181] script '/var/www/ojs/base.php' not found or unable to stat
[Thu Jul 07 07:57:35.225266 2022] [php:error] [pid 2362683] [client 109.74.204.123:36983] script '/var/www/ojs/menu.php' not found or unable to stat
[Thu Jul 07 07:57:35.493600 2022] [php:error] [pid 2360051] [client 109.74.204.123:19026] script '/var/www/ojs/inicio.php' not found or unable to stat
[Thu Jul 07 07:57:35.584164 2022] [php:error] [pid 2362685] [client 109.74.204.123:11912] script '/var/www/ojs/home.php' not found or unable to stat

(with the Custom header plugin I got no errors in the log, but same Ajax problem)

@asmecher
Copy link
Member

asmecher commented Jul 7, 2022

@marlara, none of those files are part of OJS, so I'm not sure where those messages are coming from. Are you sure there's nothing else relevant appearing in the error log?

@marlara
Copy link
Author

marlara commented Jul 7, 2022 via email

@asmecher
Copy link
Member

asmecher commented Jul 7, 2022

@marlara, can you check your browser's web development tools to see what response the server is giving when it attempts to make the request to the verb=settings page? e.g. whether it's responding with a 200 OK or 500 Internal Server Error?

@marlara
Copy link
Author

marlara commented Jul 8, 2022

It's a 500 Internal server error

@asmecher
Copy link
Member

asmecher commented Jul 8, 2022

Hi @marlara -- that should definitely correspond to a more specific message somewhere in your server logs. If not your PHP error log, then perhaps your Apache (or equivalent) log; these are sometimes kept separately.

@marlara
Copy link
Author

marlara commented Jul 8, 2022 via email

@marlara
Copy link
Author

marlara commented Jul 11, 2022

@asmecher I just only get these errors, which I don't really understand where they are coming from

[Mon Jul 11 04:08:12.485537 2022] [php:error] [pid 2424083] [client 209.97.135.24:47452] script '/var/www/ojs/info.php' not found or unable to stat
[Mon Jul 11 04:08:12.526975 2022] [negotiation:error] [pid 2423704] [client 209.97.135.24:47480] AH00687: Negotiation: discovered file(s) matching request: /var/www/ojs/config (None could be negotiated).
[Mon Jul 11 04:08:12.735517 2022] [negotiation:error] [pid 2424089] [client 209.97.135.24:47590] AH00687: Negotiation: discovered file(s) matching request: /var/www/ojs/config (None could be negotiated).
[Mon Jul 11 04:08:15.703483 2022] [negotiation:error] [pid 2423706] [client 209.97.135.24:48976] AH00687: Negotiation: discovered file(s) matching request: /var/www/ojs/config (None could be negotiated).
[Mon Jul 11 04:08:18.766080 2022] [php:error] [pid 2424083] [client 209.97.135.24:50602] script '/var/www/ojs/phpinfo.php' not found or unable to stat
[Mon Jul 11 04:08:18.853609 2022] [php:error] [pid 2423706] [client 209.97.135.24:50646] script '/var/www/ojs/info.php' not found or unable to stat

In the access.log I get this line refering to the "Custom header plugin" (I am testing with that because I got the same errors)

[11/Jul/2022:07:47:08 +0000] "GET /$$$call$$$/grid/settings/plugins/settings-plugin-grid/manage?verb=settings&plugin=customheaderplugin&category=generic&_=1657525500350 HTTP/1.1" 200 5634 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101 Firefox/91.0"

So it's a 200 there

@marlara
Copy link
Author

marlara commented Jul 11, 2022

So, I finally managed to get the PHP errors logging in. This is for the TextEditor extra:

[php:error] [pid 2434173] [client 37.103.18.12:40344] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /var/www/ojs/cache/t_compile/e7015e6e1a3406762d960366518b3414e450feaf^aad0d99d45f1c49794dd5f48888b070605c1db6e_0.plugins-1-plugins-generic-textEditorExtras-generic-textEditorExtras.settings.tpl.php:60\nStack trace:\n#0 /var/www/ojs/cache/t_compile/e7015e6e1a3406762d960366518b3414e450feaf^aad0d99d45f1c49794dd5f48888b070605c1db6e_0.plugins-1-plugins-generic-textEditorExtras-generic-textEditorExtras.settings.tpl.php(60): in_array()\n#1 /var/www/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_62c6a3b167a514_51631951()\n#2 /var/www/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#3 /var/www/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()\n#4 /var/www/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()\n#5 /var/www/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()\n#6 /var/www/ojs/lib/pkp/classes/template/PKPTemplateManager.inc.php(1072): Smarty_Internal_TemplateBase->fetch()\n#7 /var/www/ojs/lib/pkp/classes/form/Form.inc.php(197): PKPTemplateManager->fetch()\n#8 /var/www/ojs/plugins/generic/textEditorExtras/TextEditorExtrasSettingsForm.inc.php(57): Form->fetch()\n#9 /var/www/ojs/plugins/generic/textEditorExtras/TextEditorExtrasPlugin.inc.php(123): TextEditorExtrasSettingsForm->fetch()\n#10 /var/www/ojs/lib/pkp/classes/controllers/grid/plugins/PluginGridHandler.inc.php(236): TextEditorExtrasPlugin->manage()\n#11 /var/www/ojs/lib/pkp/classes/core/PKPRouter.inc.php(395): PluginGridHandler->manage()\n#12 /var/www/ojs/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest()\n#13 /var/www/ojs/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route()\n#14 /var/www/ojs/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch()\n#15 /var/www/ojs/index.php(68): PKPApplication->execute()\n#16 {main}\n thrown in /var/www/ojs/cache/t_compile/e7015e6e1a3406762d960366518b3414e450feaf^aad0d99d45f1c49794dd5f48888b070605c1db6e_0.plugins-1-plugins-generic-textEditorExtras-generic-textEditorExtras.settings.tpl.php on line 60, referer: https://aldrovandiana.it/management/settings/website

For the Custom Header I will open another ticket

asmecher added a commit to pkp/textEditorExtras that referenced this issue Jul 11, 2022
@asmecher
Copy link
Member

Thanks, @marlara, that helps! Applying this change will correct that error message: pkp/textEditorExtras@528fea3

@marlara
Copy link
Author

marlara commented Jul 12, 2022

Going near: now I got 200 but the settings aren't appearing

Schermata da 2022-07-12 11-27-16
I have this in my log file:

[Tue Jul 12 09:07:03.020650 2022] [php:notice] [pid 2442466] [client 85.206.38.111:48205] ojs2: 400 Bad Request
[Tue Jul 12 09:12:51.801648 2022] [php:notice] [pid 2442471] [client 185.191.171.38:39960] ojs2: 404 Not Found

Which I don't think is something related to that, but anyway.

@asmecher
Copy link
Member

@marlara, hmm, it's fixed over here; is there either a Javascript (browser console log) error, or a warning in the PHP error log? Could you take a look at the JSON response for the request to the settings page?

@marlara
Copy link
Author

marlara commented Jul 13, 2022

Thank you very much ascmecher, actually the JSON has status "true", but it's empty:
Schermata da 2022-07-13 11-34-21

Edit: there is no Javascript errors or PHP errors, maybe a permission problem from my side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants