Problem upgrading from 2.4.7-1 to 2.4.8-5

Hello,

I am trying to upgrade to 2.4.8-5 with php5 and the upgrading page does not show up after switching Installed to Off. The error is:

PHP Parse error: syntax error, unexpected ‘[’ in /ojs-2.4.7-1/lib/pkp/classes/core/PKPString.inc.php on line 723

What might went wrong?

Hello @aerizzz

For your information - OJS 2 is no longer maintained or supported by PKP. I recommend that you upgrade to the newest version of OJS (e.g. 3.3). However, other community members may wish to offer assistance.

You may find the following resources helpful in preparing for and performing the upgrade:

These resources will introduce you to OJS 3 and how it is different from OJS 2:

You may need to seek professional support to upgrade your installation. This can usually be acquired from the service provider that hosts or maintains your software, such as the technical support team at your institution or a third-party hosting provider.

Best regards,

Roger
PKP Team

Hello @rcgillis ,

Thanks for your answer and recommendations!

I am actually trying to upgrade to the newest OJS version. However, since the current OJS is too old, I was told in this forum that it needs to be upgraded step by step from 2.4.7-1 to 2.4.8-5, then from 2.4.8-5 to ojs 3 and so on.

I am currently trying to upgrade ojs 2.4.7 to ojs 2.4.8 and got these error I mentioned in the post. I really need help on solving this problem so that the upgrading to ojs 3 would be possible. Any help would be appreciated.

Thank you very much!

Hi @aerizzz,

What specific version of PHP are you using?

What do you see on line 723 of lib/pkp/classes/core/PKPString.inc.php?

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

We are using PHP 5.5.9 for this specific upgrade.

I checked the file and this is what’s on line 723:

$str = PKPString::regexp_replace_callback('~&#([0-9]+);~', function ($matches) { return PKPString::code2utf(matches[0]); }, $str);

that is inside of this function:

function html2utf($str) {
		// convert named entities to numeric entities
		$str = strtr($str, PKPString::getHTMLEntities());

		// use PCRE-aware replace function to replace numeric entities
                $str = PKPString::regexp_replace_callback('~&#x([0-9a-f]+);~i', function ($matches) { return PKPString::code2utf(hexdec($matches[0])); }, $str);
                $str = PKPString::regexp_replace_callback('~&#([0-9]+);~', function ($matches) { return PKPString::code2utf(matches[0]); }, $str);


		return $str;
	}

Hi @aerizzz,

There’s a typo in that code; you can correct it by changing line 723 from:

$str = PKPString::regexp_replace_callback('~&#([0-9]+);~', function ($matches) { return PKPString::code2utf(matches[0]); }, $str);

…to…

$str = PKPString::regexp_replace_callback('~&#([0-9]+);~', function ($matches) { return PKPString::code2utf($matches[0]); }, $str);

(This change is already in stable-2_4_8 git branch.)

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

Thanks for your answer!

So I changed code and the upgrading page appeared. However the page looks like this:
upgrading page 2.4.8

I really don’t know what’s wrong, but the same thing happened when I tried to upgrade to ojs3 before. I wonder if it is safe to proceed to upgrade? or what can I do to fix this?

Thank you.

Hi @aerizzz,

Did you get confirmation when you ran the upgrade process that it completed successfully?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Actually I haven’t tried running it since this is an active journal, so I wanted to make sure everything is alright before actually upgrading.

Hi @aerizzz,

I would recommend 1) taking a good backup and 2) running the upgrade in a test area, in order to be sure your install is ready for the real thing.

As for why the layout isn’t appearing, it looks to me like you’re missing a CSS file or your web server isn’t allowing the browser to fetch one. You should be able to find out more by using your browser’s inspection tools.

Regards,
Alec Smecher
Public Knowledge Project Team