Error for non-logged in users when item connected with another item that is "private"

It took me some time to troubleshoot this issue, so I thought I’d report it.

Basically, in our Omeka S installation items are often associated with other items, e.g. dcterms:subject of item “x” is another Omeka S item that we’ll call “y”.

It turns out that if the item “y” is “private”, then all views (e.g. in search pages, exploration by collection, etc.) that include in some form item “x” throw an Omeka S error for all non-logged-in users. The page itself of item “x” also throws an error.

Now, I understand that logically “y” should not be private… perhaps just a few fields inside it could be private, and I’ll update instructions to our users accordingly. But still, I guess the desired solution would be to hide reference to “y” in the item page of “x”. Besides, this hits also page searches in visualisations where reference to “y” would not be visibile anyway.

The issue is also tricky, as it is experienced only by non-logged-in users.

Please do let me know if this is not the place to report such issues, or if I should file such things on Github.

Just in case, I’ll leave here the error log I got from one of the search pages that would have included “x”. This is with the latest Omeka 2.1.0

 Error
Call to a member function valueRepresentation() on null

Dettagli:

Error: Call to a member function valueRepresentation() on null in /var/www/html/application/src/DataType/Resource/AbstractResource.php:81
Stack trace:
#0 /var/www/html/application/src/Api/Representation/ValueRepresentation.php(67): Omeka\DataType\Resource\AbstractResource->getJsonLd(Object(Omeka\Api\Representation\ValueRepresentation))
#1 [internal function]: Omeka\Api\Representation\ValueRepresentation->jsonSerialize()
#2 /var/www/html/application/src/Api/Representation/AbstractResourceRepresentation.php(290): json_encode(Object(Omeka\Api\Representation\ItemRepresentation))
#3 /var/www/html/application/Module.php(165): Omeka\Api\Representation\AbstractResourceRepresentation->embeddedJsonLd()
#4 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Omeka\Module->Omeka\{closure}(Object(Zend\EventManager\Event))
#5 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(171): Zend\EventManager\EventManager->triggerListeners(Object(Zend\EventManager\Event))
#6 /var/www/html/application/src/View/Helper/Trigger.php(61): Zend\EventManager\EventManager->triggerEvent(Object(Zend\EventManager\Event))
#7 [internal function]: Omeka\View\Helper\Trigger->__invoke('view.browse.aft...')
#8 /var/www/html/vendor/zendframework/zend-view/src/Renderer/PhpRenderer.php(397): call_user_func_array(Object(Omeka\View\Helper\Trigger), Array)
#9 /var/www/html/application/view/omeka/site/item/browse.phtml(71): Zend\View\Renderer\PhpRenderer->__call('trigger', Array)
#10 /var/www/html/vendor/zendframework/zend-view/src/Renderer/PhpRenderer.php(506): include('/var/www/html/a...')
#11 /var/www/html/vendor/zendframework/zend-view/src/View.php(207): Zend\View\Renderer\PhpRenderer->render(NULL)
#12 /var/www/html/vendor/zendframework/zend-view/src/View.php(236): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#13 /var/www/html/vendor/zendframework/zend-view/src/View.php(200): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
#14 /var/www/html/vendor/zendframework/zend-mvc/src/View/Http/DefaultRenderingStrategy.php(105): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#15 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#16 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(171): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent))
#17 /var/www/html/vendor/zendframework/zend-mvc/src/Application.php(367): Zend\EventManager\EventManager->triggerEvent(Object(Zend\Mvc\MvcEvent))
#18 /var/www/html/vendor/zendframework/zend-mvc/src/Application.php(348): Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
#19 /var/www/html/index.php(21): Zend\Mvc\Application->run()
#20 {main}

Either here or Github is fine for these kinds of reports, whichever you prefer.

Can you check/clarify one thing: are the values that this error occurs on “specific type” Resource values as can be enforced by a resource template (i.e., Item-only, etc.)? We have an existing report which we’ve fixed in the development version, and that issue is specific to those “specific resource” values.

If I understand well your question, the answer is yes: there was a resource template “forcing” that field to be an Omeka item. Good to hear this will be dealt with in a forthcoming issue.