Skip to content

Commit

Permalink
[BUG] Fix functional tests for PHP 8+
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslow committed Sep 11, 2024
1 parent 55f8976 commit 8bbe4f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/Common/Solr/SolrSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ private function getDocument(Document $record, array $highlighting, array $field
*/
private function translateLanguageCode(&$doc): void
{
if (array_key_exists('language', $doc['metadata'])) {
if (is_array($doc['metadata']) && array_key_exists('language', $doc['metadata'])) {
foreach($doc['metadata']['language'] as $indexName => $language) {
$doc['metadata']['language'][$indexName] = Helper::getLanguageName($language);
}
Expand Down
6 changes: 4 additions & 2 deletions Classes/Controller/OaiPmhController.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,13 @@ private function checkGranularity(): void
*/
protected function generateOutputForDocumentList(array $documentListSet)
{
$documentsToProcess = array_splice($documentListSet['elements'], 0, $this->settings['limit']);
if (empty($documentsToProcess)) {
// check whether any result elements are available
if (empty($documentListSet) || empty($documentListSet['elements'])) {
$this->error = 'noRecordsMatch';
return [];
}
// consume result elements from list to implement pagination logic of resumptionToken
$documentsToProcess = array_splice($documentListSet['elements'], 0, $this->settings['limit']);
$verb = $this->parameters['verb'];

$documents = $this->documentRepository->getOaiDocumentList($documentsToProcess);
Expand Down

0 comments on commit 8bbe4f8

Please sign in to comment.