Item Duplicator v1.3 causes issues after 3.0.3 upgrade

After upgrading sites to Omeka version 3.0.3, users are unable to add items manually. Results after clicking the Add button are either a 500 error message or blank browser screen. Clicking the back button takes the user to a blank add item screen (previously entered data was not saved).

I have a few sites that are still on Omeka 3.0.1, and both manual adding and duplicating of items work just fine. I will be happy to help troubleshoot in the next couple of days, but am moving forward with upgrading the rest of the sites.

My temporary solution is to deactivate the plugin, but I hope for an updated version before long - itā€™s a real time-saver!

Thanks!

Hi.
Thanks for reporting.
None of my sites is up to the newest version, so I did not notice the issue. As Iā€™ll be away for another few days, I wonā€™t have an immediate chance to look into it either, so any additional information you could give me would be useful. Enabling error reporting does give more info on whatā€™s happening?

Weā€™d (Omeka team) also be interested in more details if you have them. The changes between versions 3.0.1 and 3.0.3 are pretty minimal, so itā€™s fairly unexpected that the upgrade would cause a problem like this.

Hereā€™s what I see:


The text of the error message is:
Fatal error: Uncaught Error: Undefined constant ā€œitem_duplicator_privateā€ in /home/scklsdli/goddard.digitalsckls.info/plugins/ItemDuplicator/views/admin/items/duplicate.php:30 Stack trace: #0 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/View.php(114): include() #1 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run(ā€™/home/scklsdli/ā€¦ā€™) #2 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render(NULL) #3 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript(ā€˜items/duplicateā€¦ā€™, NULL) #4 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render() #5 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #6 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch() #7 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(ā€˜duplicateActionā€™) #8 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #9 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch() #10 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run() #11 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/Application.php(73): Zend_Application->run() #12 /home/scklsdli/goddard.digitalsckls.info/admin/index.php(28): Omeka_Application->run() #13 {main} thrown in /home/scklsdli/goddard.digitalsckls.info/plugins/ItemDuplicator/views/admin/items/duplicate.php on line 30

Let me know if I can provide any additional information!

Did you update other things when you updated Omeka? Like the version of PHP being used, or just the server generally?

This ā€œUndefined constantā€ error looks like itā€™s basically caused by a typo. Part of the pluginā€™s code that intends to use a string 'item_duplicator_private' accidentally left out the quotation marks. In older versions of PHP this results in a logged notice but the page runs anyway. I believe PHP 8 changed this behavior so itā€™s an error, like what youā€™re seeing.

So likely whatā€™s happening is that youā€™re using PHP 8 now, so this problem which was there in Item Duplicator already now just becomes a fatal error that breaks the page. With older versions of PHP, this issue would write a notice to the logs, but if you didnā€™t have error display turned on you wouldnā€™t notice it. Itā€™s probably not related to the Omeka core upgrade itself.

The problem should be easy to fix. If you wanted to try a manual fix, the problem line is this one, line 30 in views/admin/items/duplicate.php within the ItemDuplicator plugin folder. Instead of

if (get_option(item_duplicator_private)) {

it should read

if (get_option('item_duplicator_private')) {

(note the added single quotation marks).

Yes, I did upgrade to PHP 8.0.
Thanks for the information and the fix! Iā€™ll try that as soon as I can get to it, and let you know how it goes.

I made that correction, but still got the blank browser screen when I tried to duplicate an item. I turned on error reporting, and got this:

Fatal error: Uncaught Error: Undefined constant ā€œitem_duplicator_empty_fields_checkā€ in /home/scklsdli/goddard.digitalsckls.info/plugins/ItemDuplicator/ItemDuplicatorPlugin.php:212 Stack trace: #0 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/Plugin/Broker.php(154): ItemDuplicatorPlugin->hookBeforeSaveItem(Array) #1 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/Record/AbstractRecord.php(301): Omeka_Plugin_Broker->callHook(ā€˜before_save_iteā€¦ā€™, Array) #2 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/Record/AbstractRecord.php(529): Omeka_Record_AbstractRecord->runCallbacks(ā€˜beforeSaveā€™, Array) #3 /home/scklsdli/goddard.digitalsckls.info/plugins/ItemDuplicator/controllers/ItemsController.php(101): Omeka_Record_AbstractRecord->save(false) #4 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Action.php(516): ItemDuplicator_ItemsController->duplicateAction() #5 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(ā€˜duplicateActionā€™) #6 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #7 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch() #8 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run() #9 /home/scklsdli/goddard.digitalsckls.info/application/libraries/Omeka/Application.php(73): Zend_Application->run() #10 /home/scklsdli/goddard.digitalsckls.info/admin/index.php(28): Omeka_Application->run() #11 {main} thrown in /home/scklsdli/goddard.digitalsckls.info/plugins/ItemDuplicator/ItemDuplicatorPlugin.php on line 212

So I edited line 212 of that file, changing from

if (get_option(item_duplicator_empty_fields_check)) {

to

if (get_option('item_duplicator_empty_fields_check')) {

by adding the single quotes, and now it seems to be working fine! I will do some more testing later, but it looks good so far. Thank you!

Thanks to both for spotting those problems. Iā€™ll recheck the code looking for similar problems during this weekend and then fix it where needed.

Edit 15/05/2022: a fixed version (1.4) of the plugin is now available on GitHub.

1 Like

This topic was automatically closed after 250 days. New replies are no longer allowed.