Illegal string offset 'en_US'

We get

PHP Warning: Illegal string offset ‘en_US’ in /home/…/ojs-3.2.1-2/lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning: Cannot assign an empty string to a string offset in /home/…/ojs-3.2.1-2/lib/pkp/classes/core/DataObject.inc.php on line 133

what can we do better?
Thanks Andreas

Hello @Heertsch,

another user has reported. a comparable error here: [SOLVED] Illegal string offset 'en_US' in DataObject.inc.php on line 133 - #2 by Nerijus_Baliunas - you may wish to try what they have noted that they tried?

Best regards,

Roger

@Heertsch can you provide some context for when these warnings appear? What action are you taking in the system when you see this entry in the log appear? That will help us track down the source of them.

the function, where the warning is generated:

public function setData($key, $value, $locale = null) {
  if (is_null($locale)) { ...
  } else {
  	// (Un-)set a single localized value.
  	if (is_null($value)) {	...
  		}
  	} else {
  	    	**$this->_data[$key][$locale] = $value;**
  	}
  }

}

I have injected at the (bold) errorline an error-log output:

[11-Jan-2021 09:56:41 Europe/Zurich] Issue Object
(
[_data] => Array
(
[id] => 123
[journalId] => 2
[volume] => 19
[number] => 4
[year] => 2020
[published] => 1
[current] => 1
[datePublished] => 2020-12-04 13:57:45
[lastModified] => 2020-12-04 13:57:45
[accessStatus] => 1
[showVolume] => 1
[showNumber] => 1
[showYear] => 1
[showTitle] => 1
[urlPath] =>
[title] => Array
(
[en_US] => IJHDR
)

    )

[_hasLoadableAdapters] => 
[_metadataExtractionAdapters] => Array
    (
    )

[_extractionAdaptersLoaded] => 
[_metadataInjectionAdapters] => Array
    (
    )

[_injectionAdaptersLoaded] => 

)
But I’m affraid, that this does not help, because it generates a lot of output, but no warnings.
Is it possible to list the data-object only, if a warning is raised?

The setData method is used thousands of times on hundreds of objects. Can you tell us what action you are taking in the system when you see this entry appear in the logs? For example, you can provide reproduction steps like this:

  1. Go to future issues.
  2. Click edit on an issue.
  3. Enter a title.
  4. Click save.
  5. See an entry in the error log.

Also, what version of OJS are you using?

OJS-Version:[quote=“Heertsch, post:1, topic:65167”]
ojs-3.2.1-2
[/quote]
Thanks for your hints. But the problem is, that the DB is frequently used (some warnings every second).
It would help, if one can explain what code I have to inject in the above snipped, so that the data-list is only logged, if a warning happens.

Hello, I am a journal secretary and almost 2 years later I am having the same issue, but on several pages. I looked around to see if there was a fix for it on the forum but I couldn’t find any.

It seems that I get the error on the homepage, after logging in to the submissions tab and the Settings → journal tab, just above the website header.

How can i fix this?

Warning : Illegal string offset ‘en_US’ in /home2/ki301910/public_html/lib/pkp/classes/core/DataObject.inc.php on line 133

Warning : Cannot assign an empty string to a string offset in /home2/ki301910/public_html/lib/pkp/classes/core/DataObject.inc.php on line 133

I think our hosting provider upgraded the PHP version, but I am not sure.
Thank you!
Silviu.

EDIT: the issue resolved itself after changing the system PHP version to 8.0.

This topic was automatically closed after 4 days. New replies are no longer allowed.