[OJS 3.1.0.1] Error in php log customBlockManager

Hi @asmecher, so, for the first two:

from

function getBlockContext() {
	if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_SIDEBAR;
	return parent::getBlockContext();
}

to

function getBlockContext($contextId = null) {
	if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_SIDEBAR;
	return parent::getBlockContext($contextId);
}

and from

function getEnabled() {
	if (!Config::getVar('general', 'installed')) return true;
	return parent::getEnabled();
}

to

function getEnabled($contextId = null) {
	if (!Config::getVar('general', 'installed')) return true;
	return parent::getEnabled($contextId);
}

instead, for the last one, PHP Strict Standards: Declaration of SubmissionFileDAO::fromRow() i checked the result after applyed patch, but for the front-end site no errors in php log, but, in back-end site showed me new errors, so i returned to original code.

copy the errors, after my modify:

[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:54 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:55 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:56 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:56 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:56 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889
[21-Dec-2017 09:53:56 Europe/Berlin] PHP Notice: Undefined variable: fileImplementation in /Applications/MAMP/htdocs/agro/lib/pkp/classes/submission/PKPSubmissionFileDAO.inc.php on line 889

Bye!
Tiziano

Hi @Tiziano,

I’d suggest reverting your change for that last one – it’s not a trivial fix like the first two, and your change is likely to cause problems. The warnings you were originally getting are cosmetic and can be ignored until it’s fixed fully in a future release.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

i get this warning error. how can i fix it?

Strict Standards: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /home/bmebbior/public_html/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 19

thanks a lot

Hi @hari_pramono,

That’s cosmetic and I’d suggest ignoring it. We’ll be working to resolve these in the next few releases.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi. I did this patch and still get the error.

function getContents($templateMgr, $request = null) {
# removed the ampersand sign before $templateMgr above
# jmo
$context = $request->getContext();
$contextId = $context ? $context->getId() : 0;

  // Get the block contents.
  $customBlockContent = $this->getSetting($contextId, 'blockContent');
  $currentLocale = AppLocale::getLocale();
  # $contextPrimaryLocale = $context->getPrimaryLocale(); replaced by below line
  $contextPrimaryLocale = $context?$context->getPrimaryLocale():$request->getSite()->getPrimaryLocale();
  # jmo 
  # https://forum.pkp.sfu.ca/t/local-installation-of-ojs-3-1-on-windows/37220/6

Hi @johnostrowick,

What version of OJS are you using? Which of the above messages are you trying to resolve?

You can use three backticks (```) on this forum to quote sections of code; otherwise they’re hard to read.

Regards,
Alec Smecher
Public Knowledge Project Team

3.1.0, as far as I can tell.

Hi @johnostrowick,

See How do I determine my PKP software's version? - #2 if you’re not sure what version you’re using. Can you answer the other question above? Also, I can’t read the quoted code you posted; don’t forget to use backticks to quote code sections.

Regards,
Alec Smecher
Public Knowledge Project Team

version 3.1.0.1

The error I am trying to solve is:


Warning: Declaration of CustomBlockPlugin::getEnabled() should be compatible with BlockPlugin::getEnabled($contextId = NULL) in /var/www/issa.africa/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 140```

Hi @johnostrowick,

That warning is already resolved in OJS 3.1.2. But it’s just cosmetic and shouldn’t be causing any failures, unless you have configured your system to display error messages in the browser; if you’ve done that, warnings will interrupt AJAX requests and cause problems there. It is better to configure your system to send error and warning messages to the log.

Regards,
Alec Smecher
Public Knowledge Project Team

OK but it’s a production server so I can’t tinker too much.
I’ve tried

error_reporting = ~E_ALL
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT```

none seem to help

Hi @johnostrowick,

Are your errors/warnings going to the browser, or to the log file?

Regards,
Alec Smecher
Public Knowledge Project Team

browser; if it was just the log file I’d not be bothered. However, the client is bothered.

[removed spam]

oh great, i see it received the spam injection as well

Hi @johnostrowick,

You’ll need to work with the display_errors setting (it’s in both config.inc.php and your PHP configuration).

You’ll definitely need to fix the spam injection you mentioned on your other thread before you can expect things to behave predictably. I just posted about a similar problem on another thread.

Regards,
Alec Smecher
Public Knowledge Project Team

hi. If I chmod the index.php will that stop the spam injection?

also, I set

display_errors = Off

but… still gives errors. see attached.

57

Hi @johnostrowick,

If I chmod the index.php will that stop the spam injection?

No, if there is already a malware injection, changing file permissions won’t help. The malware will very likely have modified your PHP code, and those modifications will need to be removed.

also, I set

display_errors = Off

but… still gives errors. see attached.

If display_errors is set to Off in both config.inc.php and php.ini, but you’re still seeing error/warning messages sent to the browser, I suspect this is a side-effect of the malware problem. I suspect cleaning that up will cause the configuration file settings for display_errors to be respected.

Regards,
Alec Smecher
Public Knowledge Project Team

ok thanks. Let me see what I can find.
hmmm … nothing obvious.
Can you look at the site and see if from where you are , you still get the spam site?

url italianstudiesinsa dot org

Aha, this was overruling /etc/…php.ini.

errors are gone now. thanks. solved