Failed AJAX request or invalid JSON returned

@asmecher, It goes below:

1 {**
2 * plugins/generic/googleAnalytics/settingsForm.tpl
3 *
4 * Copyright (c) 2014-2019 Simon Fraser University
5 * Copyright (c) 2003-2019 John Willinsky
6 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
7 *
8 * Google Analytics plugin settings
9 *
10 *}
11
17
18 <form class=“pkp_form” id=“gaSettingsForm” method=“post” action=“{url router=$smarty.const.ROUTE_COMPONENT op=“manage” category=“generic” plugin=$pluginNa me verb=“settings” save=true}”>
19 {csrf}
20 {include file=“controllers/notification/inPlaceNotification.tpl” notificationId=“gaSettingsFormNotification”}
21
22

{translate key=“plugins.generic.googleAnalytics.manager.settings.description”}

23
24 {fbvFormArea id=“webFeedSettingsFormArea”}
25 {fbvElement type=“text” name=“googleAnalyticsSiteId” value=$googleAnalyticsSiteId label=“plugins.generic.googleAnalytics.manager.settings. googleAnalyticsSiteId”}
26 {/fbvFormArea}
27
28 {fbvFormButtons}
29
30

{translate key=“common.requiredField”}


31

Hi @GabeLon,

What version of OJS are you using? The directory name in your stack trace suggests OJS 3.1.2 but it doesn’t look like that’s exactly what you’re using.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, yes I am using OJS 3.1.2 version.

Just in case it helps I am pasting the last generated error log lines, immediately after the error is trigered:

684189 [Sun Sep 01 19:30:29.112275 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_A RTICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plug ins/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 90
684190 [Sun Sep 01 19:30:29.112328 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_A RTICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plug ins/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 93
684191 [Sun Sep 01 19:30:30.204274 2019] [php7:warn] [pid 19597] [client 148.251.41.239:42056] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_AR TICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plugi ns/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 90
684192 [Sun Sep 01 19:30:30.204321 2019] [php7:warn] [pid 19597] [client 148.251.41.239:42056] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_AR TICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plugi ns/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 93
684193 [Sun Sep 01 19:30:33.967395 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: Declaration of SubmissionKeywordEntryDAO::getByC ontrolledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $ rangeInfo = NULL, $filter = NULL) in /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 20
684194 [Sun Sep 01 19:30:33.987123 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: call_user_func() expects parameter 1 to be a val id callback, class ‘OldGreggThemePlugin’ does not have a method ‘htmlDisplay’ in /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/plugins/HookRegist ry.inc.php on line 107
684195 [Sun Sep 01 19:30:35.281885 2019] [php7:error] [pid 20307] [client 152.168.24.71:56789] PHP Fatal error: Uncaught Exception: FBV: Element ID not set i n /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/form/FormBuilderVocabulary.inc.php:228\nStack trace:\n#0 /var/www/evidencia-ojs-stable-3_1_2/cach e/t_compile/55bbc94aad9a8e9ff975a7d5d01ca8b0f271708f^6cbc5ba39155412247b5f98511541e3902dcbd93_0.plugins-plugins-generic-googleAnalytics-generic-googleA nalytics.settingsForm.tpl.php(53): FormBuilderVocabulary->smartyFBVElement(Array, Object(Smarty_Internal_Template))\n#1 /var/www/evidencia-ojs-stable-3 _1_2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5d67fb362d3881_59219782(Object(Smarty_Internal_Te mplate))\n#2 /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Re source_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))\n#3 /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/lib/vendor/smarty/smarty/libs/sy splugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(O in /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/form/FormBuilderV ocabulary.inc.php on line 228, referer: http://www.evidencia.org/index.php/Evidencia/management/settings/website
684196 [Sun Sep 01 19:30:35.465506 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_A RTICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plug ins/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 90
684197 [Sun Sep 01 19:30:35.465575 2019] [php7:warn] [pid 20513] [client 173.208.157.186:33728] PHP Warning: Use of undefined constant STATISTICS_DIMENSION_A RTICLE_ID - assumed ‘STATISTICS_DIMENSION_ARTICLE_ID’ (this will throw an Error in a future version of PHP) in /var/www/evidencia-ojs-stable-3_1_2/plug ins/generic/recommendByAuthor/RecommendByAuthorPlugin.inc.php on line 93
684198 [Sun Sep 01 19:30:41.105879 2019] [php7:warn] [pid 20509] [client 148.251.41.239:52316] PHP Warning: Declaration of SubmissionKeywordEntryDAO::getByCo ntrolledVocabId($controlledVocabId, $rangeInfo = NULL) should be compatible with ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, $r angeInfo = NULL, $filter = NULL) in /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 20
684199 [Sun Sep 01 19:30:41.184373 2019] [php7:warn] [pid 20509] [client 148.251.41.239:52316] PHP Warning: call_user_func() expects parameter 1 to be a vali d callback, class ‘OldGreggThemePlugin’ does not have a method ‘htmlDisplay’ in /var/www/evidencia-ojs-stable-3_1_2/lib/pkp/classes/plugins/HookRegistr y.inc.php on line 107

Hi @GabeLon,

Have you modified plugins/generic/googleAnalytics/settingsForm.tpl somehow? The version that comes with OJS 3.1.2-0 is different than the one you posted.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Have you modified plugins/generic/googleAnalytics/settingsForm.tpl somehow? The version that comes with OJS 3.1.2-0 is different than the one you posted.

Not that I know, or at least not intentionally.

I got a little confused about which file you are referring:
/plugins/generic/googleAnalytics/templates/settingsForm.tpl
/plugins/generic/googleAnalytics/GoogleAnalyticsSettingsForm.inc.php
or both?

Since I couldn’t find changes from those files when comparing (a first glance) OJS 3.1.2-0 Github repo, I will redo a cleaner copy-paste of the code of both files below:

/plugins/generic/googleAnalytics/templates/settingsForm.tpl

{**

 * plugins/generic/googleAnalytics/settingsForm.tpl

 *

 * Copyright (c) 2014-2019 Simon Fraser University

 * Copyright (c) 2003-2019 John Willinsky

 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.

 *

 * Google Analytics plugin settings

 *

 *}

<script>

$(function() {ldelim}

// Attach the form handler.

$('#gaSettingsForm').pkpHandler('$.pkp.controllers.form.AjaxFormHandler');

{rdelim});

</script>

<form class="pkp_form" id="gaSettingsForm" method="post" action="{url router=$smarty.const.ROUTE_COMPONENT op="manage" category="generic" plugin=$pluginName verb="settings" save=true}">

{csrf}

{include file="controllers/notification/inPlaceNotification.tpl" notificationId="gaSettingsFormNotification"}

<div id="description">{translate key="plugins.generic.googleAnalytics.manager.settings.description"}</div>

{fbvFormArea id="webFeedSettingsFormArea"}

{fbvElement type="text" name="googleAnalyticsSiteId" value=$googleAnalyticsSiteId label="plugins.generic.googleAnalytics.manager.settings.googleAnalyticsSiteId"}

{/fbvFormArea}

{fbvFormButtons}

<p><span class="formRequired">{translate key="common.requiredField"}</span></p>

</form>

/plugins/generic/googleAnalytics/GoogleAnalyticsSettingsForm.inc.php

<?php

/**
 * @file plugins/generic/googleAnalytics/GoogleAnalyticsSettingsForm.inc.php
 *
 * Copyright (c) 2014-2019 Simon Fraser University
 * Copyright (c) 2003-2019 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class GoogleAnalyticsSettingsForm
 * @ingroup plugins_generic_googleAnalytics
 *
 * @brief Form for journal managers to modify Google Analytics plugin settings
 */

import('lib.pkp.classes.form.Form');

class GoogleAnalyticsSettingsForm extends Form {

	/** @var int */
	var $_journalId;

	/** @var object */
	var $_plugin;

	/**
	 * Constructor
	 * @param $plugin GoogleAnalyticsPlugin
	 * @param $journalId int
	 */
	function __construct($plugin, $journalId) {
		$this->_journalId = $journalId;
		$this->_plugin = $plugin;

		parent::__construct($plugin->getTemplateResource('settingsForm.tpl'));

		$this->addCheck(new FormValidator($this, 'googleAnalyticsSiteId', 'required', 'plugins.generic.googleAnalytics.manager.settings.googleAnalyticsSiteIdRequired'));

		$this->addCheck(new FormValidatorPost($this));
		$this->addCheck(new FormValidatorCSRF($this));
	}

	/**
	 * Initialize form data.
	 */
	function initData() {
		$this->_data = array(
			'googleAnalyticsSiteId' => $this->_plugin->getSetting($this->_journalId, 'googleAnalyticsSiteId'),
		);
	}

	/**
	 * Assign form data to user-submitted data.
	 */
	function readInputData() {
		$this->readUserVars(array('googleAnalyticsSiteId'));
	}

	/**
	 * @copydoc Form::fetch()
	 */
	function fetch($request, $template = null, $display = false) {
		$templateMgr = TemplateManager::getManager($request);
		$templateMgr->assign('pluginName', $this->_plugin->getName());
		return parent::fetch($request, $template, $display);
	}

	/**
	 * Save settings.
	 */
	function execute() {
		$this->_plugin->updateSetting($this->_journalId, 'googleAnalyticsSiteId', trim($this->getData('googleAnalyticsSiteId'), "\"\';"), 'string');
	}
}

Thank for your help and patience!

Hi @GabeLon,

Have a look at plugins/generic/googleAnalytics/settingsForm.tpl. Your version has…

{fbvElement type="text" name="googleAnalyticsSiteId" value=$googleAnalyticsSiteId label="plugins.generic.googleAnalytics.manager.settings.googleAnalyticsSiteId"}

…while the file from OJS 3.1.2 should have…

{fbvElement type="text" id="googleAnalyticsSiteId" value=$googleAnalyticsSiteId label="plugins.generic.googleAnalytics.manager.settings.googleAnalyticsSiteId"}

Note the difference between name= and id=.

While the quickest thing to do will be to make that change manually, I’m wondering if this hints towards other changes that might cause trouble, so if you can track down the cause of this discrepancy it might be helpful.

Thanks,
Alec Smecher
Public Knowledge Project Team

1 Like

@asmecher, as you pointed, changing “name” for “id” solved the error.
I really can’t say why the original file changed, but am going to see if I can find any clue.

Thanks for your help!

Capture

How to fix error above? that location after doing click button schedule for publication.

this error log file “PHP message: PHP Warning: assert(): Assertion failed in /classes/article/Article.inc.php on line 94” while reading response header from upstream

Hi @ghaniavi,

I don’t think you’re encountering the same problem as the rest of this thread… Can you post a new topic? Please include which of our applications you’re using, and what version.

Regards,
Alec Smecher
Public Knowledge Project Team

please check at link How to fix error after doing click button schedule for publication

Thanks

Hello,

I am facing similar issue, when we try to access Users from different Journal’s DNS as seen in attachment. Further investigating I see that it is the CORS error as seen in attachment. Can you suggest us how to go about resolving this issue? Thank you for your support!

users

users-error

End Of Message.

I am using OJS 3.2.1-1 and I get this same error when

  1. I try Adding Reviewers to my Submission,
  2. I attempt to upload files under the “CopyEditing” tab of my Submission

Add Reviewers
Upload FIles

My error log says:
[Mon Jul 13 16:20:48.780022 2020] [php7:notice] [pid 12872] [client 129.56.114.223:55453] PHP Notice: Undefined property: PKP\components\listPanels\PKPSelectReviewerListPanel::$lazyLoad in /var/www/html/lib/pkp/classes/components/listPanels/ListPanel.inc.php on line 97, referer: http://<my_site>/index.php/njtd/workflow/index/1/3

Please help urgently

Hi @dare,

I think that warning is just cosmetic, but look further back in your log file for something containing the word “Error”.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,

Thank you for your response.

I tried replicating the error I get and below is the breakdown of what I got:

  1. When I tried adding a reviewer , I get:
    [Mon Jul 13 19:29:15.557714 2020] [php7:notice] [pid 9773] [client 129.56.96.37:50219] PHP Notice: Undefined property: PKP\components\listPanels\PKPSelectReviewerListPanel::$lazyLoad in /var/www/html/lib/pkp/classes/components/listPanels/ListPanel.inc.php on line 97, referer: http://<server_url>/index.php/njtd/workflow/index/1/3

  2. When I tried uploading files in the “Copy Editing” tab , I get
    [Mon Jul 13 19:30:06.179726 2020] [php7:warn] [pid 13495] [client 129.56.96.37:50229] PHP Warning: Declaration of ManageSubmissionFilesForm::execute($stageSubmissionFiles, $fileStage = NULL) should be compatible with Form::execute(…$functionArgs) in /var/www/html/lib/pkp/controllers/grid/files/form/ManageSubmissionFilesForm.inc.php on line 19, referer: http://<server_url>/index.php/njtd/workflow/index/1/3

Hi @dare,

Those are also cosmetic. Look in your log file for something containing the word “Error”.

Regards,
Alec Smecher
Public Knowledge Project Team