Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Plugin/rest/resource/OaiPmh.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ protected function listIdentifiers() {
$this->oaiEntity = $entity;
$identifier = $this->buildIdentifier($entity);
$this->loadEntity($identifier, TRUE);
// The cache table can reference an entity the current (anonymous) user
// cannot view, or one that has since been deleted. In both cases
// loadEntity() sets $this->entity to FALSE. Skip the record instead of
// calling getHeaderById() on FALSE, which fatals. This mirrors the FALSE
// handling getRecord() already performs for the GetRecord verb.
if (empty($this->entity)) {
continue;
}
$this->response[$this->verb]['header'][] = $this->getHeaderById($identifier);
}
if (empty($this->response[$this->verb]['header'])) {
Expand All @@ -486,6 +494,14 @@ protected function listRecords() {
$this->oaiEntity = $entity;
$identifier = $this->buildIdentifier($entity);
$this->loadEntity($identifier, TRUE);
// The cache table can reference an entity the current (anonymous) user
// cannot view, or one that has since been deleted. In both cases
// loadEntity() sets $this->entity to FALSE. Skip the record instead of
// calling getRecordById() on FALSE, which fatals. This mirrors the FALSE
// handling getRecord() already performs for the GetRecord verb.
if (empty($this->entity)) {
continue;
}
$this->response[$this->verb]['record'][] = $this->getRecordById($identifier);
}
if (empty($this->response[$this->verb]['record'])) {
Expand Down