OAI Error badVerb in OJS 3.0.2

How to solve it?

URL http://revistas.uis.edu.co/index.php/revistaboletindegeologia/oai

OAI Error(s)
The request could not be completed due to the following error or errors.

Error Code badVerb
Illegal OAI verb

Hi @drueda,

That isn’t a problem – that’s how the OAI implementation is expected to behave according to the OAI-PMH specification.

Regards,
Alec Smecher
Public Knowledge Project Team

but REDIB inform:

Click on the tab “ListRecords” the following error appears:

DB Error: ERROR: el mensaje de enlace (bind) entrega 2 parámetros, pero la sentencia preparada «» requiere 1

How to solve it?

Hi @drueda,

Can you enable show_stacktrace in your config.inc.php, reload the page, and post the resulting error trace here?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
I send the message

DB Error: ERROR: el mensaje de enlace (bind) entrega 2 parámetros, pero la sentencia preparada «» requiere 1

Stack Trace:

File: /var/www/html/revista/lib/pkp/classes/oai/PKPOAIDAO.inc.php line 427
Function: DAO->retrieve(“SELECT CASE WHEN COALESCE(dot.date_deleted, a.last_modified) < i…”, Array(2))

File: /var/www/html/revista/lib/pkp/classes/oai/PKPOAIDAO.inc.php line 141
Function: PKPOAIDAO->_getRecordsRecordSet(Array(2), Null, Null, Null)

File: /var/www/html/revista/classes/oai/ojs/JournalOAI.inc.php line 177
Function: PKPOAIDAO->getRecords(Array(2), Null, Null, Null, 0, 100, 0)

File: /var/www/html/revista/lib/pkp/classes/oai/OAI.inc.php line 506
Function: JournalOAI->records(“oai_dc”, Null, Null, Null, 0, 100, 0)

File: /var/www/html/revista/lib/pkp/classes/oai/OAI.inc.php line 85
Function: OAI->ListRecords()

File: /var/www/html/revista/pages/oai/OAIHandler.inc.php line 43
Function: OAI->execute()

File: (unknown) line (unknown)
Function: OAIHandler->index(Array(0), Object(Request))

File: /var/www/html/revista/lib/pkp/classes/core/PKPRouter.inc.php line 372
Function: call_user_func(Array(2), Array(0), Object(Request))

File: /var/www/html/revista/lib/pkp/classes/core/PKPPageRouter.inc.php line 239
Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(0), False)

File: /var/www/html/revista/lib/pkp/classes/core/Dispatcher.inc.php line 134
Function: PKPPageRouter->route(Object(Request))

File: /var/www/html/revista/lib/pkp/classes/core/PKPApplication.inc.php line 227
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/html/revista/index.php line 68
Function: PKPApplication->execute()

Hi @drueda,

Is this a git checkout? If so, I wonder whether your ojs and pkp-lib repositories are out of date with respect to each other.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

This is when I Click on the tab “ListRecords”.

How can I check, pkp-lib?

Hi @drueda,

Did you check this copy of OJS out from git or github, or did you install it from the .tar.gz file?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

It was installed from the .tar.gz file

Hi @drueda,

Is it an option to upgrade to a newer release? OJS 3.1.0-1 is the latest at the moment, and it has a lot of fixes/improvements over OJS 3.0.2.

Regards,
Alec Smecher
Public Knowledge Project Team

HI @asmecher

At the moment, it is not possible to update, what other solution can be applied?

Hi @drueda,

Is there a particular reason that an upgrade is out of the question?

Regards,
Alec Smecher
Public Knowledge Project Team

hi @asmecher,

The reason is because we are in the process of academic certification for some of our journals and also because the last update (from 2.4.8 to 3.0.1) took a long time, so the staff programmed the next upgrade after the end of the certification process. That’s about at least three months from now. Some of the requirements for the certification includes this process (quite a paradox).

To summarize the issue, the installation was done using the 3.0.2.tar.gz stable release . I double checked the OAI and Dublin Core classes with the release and compared it with the git. The dublin plugin is exactly the same (version 1.1 for release and current git) but the OAI classes have several changes. It would be wise to replace/update the OAI classes with the git repo or there are still many things related to this that can be affected? what are our chances?

Thx alec

Hi @hekutoru2kx,

As you’ve seen, the upgrade process from OJS 2.x to 3.x is a very large change – possibly the most profound change since OJS 2.0 was introduced back in 2005. The upgrade from 3.0.2 to 3.1.0-1 will be relatively inconsequential to perform, but will get you a lot of minor fixes and tweaks that have been released since then, and it’s likely that an OAI issue like you describe would be fixed in 3.1.0-1.

I checked OJS 3.0.2 and could successfully fetch a list of records, which makes use of the query that seems to be broken in your installation. I’d suggest double-checking your installation to make sure there aren’t any modifications, particularly in classes/oai and lib/pkp/classes/oai.

Regards,
Alec Smecher
Public Knowledge Project Team

Thx for the quick reply as always @asmecher,

I checked again the classes in ojs and in the lib-pkp and there are no modifications. So, I did a trace of the process and it seems the problem is related to the sql query structure and the params is receiving.

In this part of the code:

	function getEarliestDatestamp($selectStatement, $setIds = array()) {
		$params = $this->getOrderedRecordParams(null, $setIds);
		$result = $this->retrieve(
			$selectStatement . ' FROM mutex m ' .
			$this->getRecordJoinClause(null, $setIds) . ' ' .
			$this->getAccessibleRecordWhereClause(),
			$params
		);

the produced query is this one:

SELECT CASE 
	WHEN COALESCE(dot.date_deleted, a.last_modified) > i.last_modified THEN
		i.last_modified 
	ELSE COALESCE(dot.date_deleted, a.last_modified) END 
FROM mutex m LEFT JOIN published_submissions pa ON (m.i=0) 
	LEFT JOIN submissions a ON (a.submission_id = pa.submission_id AND a.context_id = ?) 
	LEFT JOIN issues i ON (i.issue_id = pa.issue_id) 
	LEFT JOIN sections s ON (s.section_id = a.section_id) 
	LEFT JOIN journals j ON (j.journal_id = a.context_id) 
	LEFT JOIN data_object_tombstones dot ON (m.i = 1) 
	LEFT JOIN data_object_tombstone_oai_set_objects tsoj ON (tsoj.tombstone_id = dot.tombstone_id AND tsoj.assoc_type = 256) 
	LEFT JOIN data_object_tombstone_oai_set_objects tsos ON tsos.assoc_id = null 
WHERE ((s.section_id IS NOT NULL AND i.published = 1 AND j.enabled = 1 AND a.status <> 4) OR (dot.data_object_id IS NOT NULL)) 

And the param object received is an array with the value of the context id. The issue is that this array length is two array[context_id, context_id]. That means, two params, but the query is needing only one. I forced the $param in the retrieve to $param[0] and the error for this part was solved. But all the other functions as well have this issue.

During the update to 3.0.2 we had several issues with some array variables due to the postgres database where we had to specify the variable as an array. The problem might be related to the lack of “smartness” in the postgres libraries to handle arrays or something, in this case to assign the first and ignore the rest of the objects from the array.

Can you make another check with this conditions?

Regards,
Hector Hernandez

Hi @hekutoru2kx,

Hmm, I’m trying with an OJS 3.0.2 install and PostgreSQL and I still can’t replicate that behavior. Are you doing a straight-up ListRecords request, or something involving sets etc?

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher,

Is actually a straight-up request. But, anyway, the behaviour with each options is as follow:

  • /oai
    OAI Error(s)

The request could not be completed due to the following error or errors.
Error Code badVerb

Illegal OAI verb

  • /oai?verb=Identify
    error: bind message supplies 2 parameters, but prepared statement “” requires 1

  • /oai?verb=ListRecords&metadataPrefix=oai_dc
    error: bind message supplies 2 parameters, but prepared statement “” requires 1

  • /oai?verb=ListSets
    It shoes me the journal list with the options of identifiers and records. If i access any option it gives me an Http Error 500

  • /oai?verb=ListIdentifiers&metadataPrefix=oai_dc
    error: bind message supplies 2 parameters, but prepared statement “” requires 1

So, I traced the parameter that the function is receiving and the instruction in the line 292 of /lib/pkp/classes/oai/PKPOAIDAO.inc.php is the one duplicating the parameter.

051   	function getEarliestDatestamp($selectStatement, $setIds = array()) {
052   		$params = $this->getOrderedRecordParams(null, $setIds);

264 	function getOrderedRecordParams($dataObjectId = null, $setIds = array(), $set = null) {
265 		$params = array();
266 
267 		if (isset($dataObjectId)) {
268 			$params[] = $dataObjectId;
269 		}
270 
271 		$notNullSetIds = array();
272 		if (is_array($setIds) && !empty($setIds)) {
273 			foreach($setIds as $id) {
274 				// Avoid null values.
275 				if (is_null($id)) continue;
276 				$notNullSetIds[] = (int) $id;
277 				$params[] = (int) $id;
278 			}
279 		}
280 
281 		// Add the data object id again.
282 		if (isset($dataObjectId)) {
283 			$params[] = $dataObjectId;
284 		}
285 
286 		// Add the set specification, if any.
287 		if (isset($set)) {
288 			$params[] = $set;
289 		}
290 
291 		// Add the set ids again, so they can be used in the tombstone JOIN part of the sql too.
292 		$params = array_merge($params, $notNullSetIds);
293 
294 		return $params;
295 	}

The dump of the variables in the lines is as follow:

264:
dataObjectId: NULL 
setIds: array(1) { [0]=> string(1) "4" } 
set: NULL

265:
params: array(0) { } 

269:
dataObjectId: NULL 
params: array(0) { } 

271:
setIds: array(1) { [0]=> string(1) "4" } 
277:
id:4

279:
params: array(1) { [0]=> int(4) } 
notNullSetIds: array(1) { [0]=> int(4) } 

289:
params: array(1) { [0]=> int(4) } 

294:
params: array(2) { [0]=> int(4) [1]=> int(4) } 

This is the behaviour I’m getting. As I can see from the function idea is that this merge should merge without duplicates but is not doing it right. The PHP Version I’m working is 5.5.21

Hi @hekutoru2kx,

Hmm, interesting that you have a set ID specified even during an Identify request – I don’t think that should be the case. Do you have the Driver or OpenAIRE plugins enabled?

Regards,
Alec Smecher
Public Knowledge Project Team

Hello,

Yes, we have them enabled. I disabled them and did a test again and still the same error.

The full link is “ojs/index.php/journalname/oai?verb=Identify”.

Is there any test that may I need to clarify the issue?

Hi @hekutoru2kx,

Hmm, I’m still not able to figure out why a set ID is apparently being specified in a request like “Identify” that doesn’t use set IDs. I’d suggest investigating where the set IDs are entering the equation – there should be none.

Regards,
Alec Smecher
Public Knowledge Project Team