diff --git a/library/Class/WebService/OAI/Request/ListIdentifiers.php b/library/Class/WebService/OAI/Request/ListIdentifiers.php index d2cc9416155e62e07df5cbb77f419f840e57a22d..179fac72fa317e6c44a8870174ffdebbe6dc2b63 100644 --- a/library/Class/WebService/OAI/Request/ListIdentifiers.php +++ b/library/Class/WebService/OAI/Request/ListIdentifiers.php @@ -48,12 +48,17 @@ class Class_WebService_OAI_Request_ListIdentifiers { $this->_until = $this->_params['until']; $this->_resumptionToken = $this->_params['resumptionToken']; + if ($this->_resumptionToken && ($token = Class_WebService_OAI_ResumptionToken::find($this->_resumptionToken))) { $this->_set = $token->getParam('set'); $this->_from = $token->getParam('from'); $this->_until = $token->getParam('until'); } + if (!strtotime($this->_until)) + $this->_until = null; + if (!strtotime($this->_from)) + $this->_from = null; $this->_catalogue = $this->getCatalogueFromSetSpec($this->_set); } diff --git a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php index 4dc5f167e01df65c5176807860c1b77d52f1d865..e2b02352ea86fdf073a34a8e21f43e561d71df85 100644 --- a/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php +++ b/tests/application/modules/opac/controllers/OAIControllerListIdentifiersTest.php @@ -298,6 +298,16 @@ class OAIControllerListIdentifiersInvalidParamsTest extends AbstractControllerTe $this->_xpath->assertXPath($this->_response->getBody(), '//oai:error[@code="badResumptionToken"]'); } + + /** @test */ + public function withBadFromAndUntilResponseShouldNotContainsAttributes() { + $this->dispatch('/opac/oai/request?verb=ListIdentifiers&metadataPrefix=oai_dc&set=really_wrong_set&from=some_random_date&until=some_random_date'); + $this->_xpath->assertXPath($this->_response->getBody(), + '//oai:request[not(@from)][not(@until)]'); + + } + + }