Omeka S 3.1.0 "asHtml()" error

Hello. After updating Omeka S to the latest version 3.1.0 I have found a new error in my personalized theme that did not occur in the previous 3.0.2 version . Specifically in this strings of the browse.phtml (item-set) file:

  $descripcion = $body; ?>
                <?php if ($descripcion) {
                        if (mb_strlen($descripcion) > 110) {
                            echo '<div class="description">' . $descripcion . ' [...]' . '</div>';
                        } else {
                            echo '<div class="description">' . $descripcion->asHtml() . '</div>';
                        }
                    };
  ?>

That “->asHtml()” produces the following error:


Laminas\Db\Adapter\Exception\InvalidQueryException
Statement could not be executed (42000 - 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"log" ("created","severity","message","owner_id","context") VALUES ('2021-09-14 ' at line 1)

Detalles:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"log" ("created","severity","message","owner_id","context") VALUES ('2021-09-14 ' at line 1 in /home/site/www/vendor/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php:238
Stack trace:
#0 /home/site/www/vendor/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php(238): PDOStatement->execute()
#1 /home/site/www/vendor/laminas/laminas-log/src/Writer/Db.php(128): Laminas\Db\Adapter\Driver\Pdo\Statement->execute(Array)
#2 /home/site/www/vendor/laminas/laminas-log/src/Writer/AbstractWriter.php(282): Laminas\Log\Writer\Db->doWrite(Array)
#3 /home/site/www/vendor/laminas/laminas-log/src/Logger.php(459): Laminas\Log\Writer\AbstractWriter->write(Array)
#4 /home/site/www/vendor/laminas/laminas-log/src/Logger.php(502): Laminas\Log\Logger->log(3, 'Error: Call to ...', Array)
#5 /home/site/www/application/src/Mvc/ExceptionListener.php(54): Laminas\Log\Logger->err('Error: Call to ...')
#6 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Omeka\Mvc\ExceptionListener->handleException(Object(Laminas\Mvc\MvcEvent))
#7 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
#8 /home/site/www/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(122): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
#9 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Laminas\Mvc\MvcEvent))
#10 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
#11 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(366): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
#12 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(347): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent))
#13 /home/site/www/index.php(21): Laminas\Mvc\Application->run()
#14 {main}

Next Laminas\Db\Adapter\Exception\InvalidQueryException: Statement could not be executed (42000 - 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"log" ("created","severity","message","owner_id","context") VALUES ('2021-09-14 ' at line 1) in /home/site/www/vendor/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php:243
Stack trace:
#0 /home/site/www/vendor/laminas/laminas-log/src/Writer/Db.php(128): Laminas\Db\Adapter\Driver\Pdo\Statement->execute(Array)
#1 /home/site/www/vendor/laminas/laminas-log/src/Writer/AbstractWriter.php(282): Laminas\Log\Writer\Db->doWrite(Array)
#2 /home/site/www/vendor/laminas/laminas-log/src/Logger.php(459): Laminas\Log\Writer\AbstractWriter->write(Array)
#3 /home/site/www/vendor/laminas/laminas-log/src/Logger.php(502): Laminas\Log\Logger->log(3, 'Error: Call to ...', Array)
#4 /home/site/www/application/src/Mvc/ExceptionListener.php(54): Laminas\Log\Logger->err('Error: Call to ...')
#5 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Omeka\Mvc\ExceptionListener->handleException(Object(Laminas\Mvc\MvcEvent))
#6 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
#7 /home/site/www/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(122): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
#8 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Laminas\Mvc\MvcEvent))
#9 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
#10 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(366): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
#11 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(347): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent))
#12 /home/site/www/index.php(21): Laminas\Mvc\Application->run()
#13 {main}

First of all, congratulations on the new version, it includes very interesting features and I am really happy to see Omeka S evolve. Greetings.

The error message you have here looks like it’s actually related to an error in saving the log message itself. Do you have a module installed that affects logging? You might need to disable it to see whatever the actual error is here.

Thanks, John, for your answer. After uninstall Log module, the error change:

 Error
Call to a member function asHtml() on string

Detalles:

Error: Call to a member function asHtml() on string in /home/site/www/themes/patrimoniouja/view/omeka/site/item-set/browse.phtml:73
Stack trace:
#0 /home/site/www/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(505): include()
#1 /home/site/www/vendor/laminas/laminas-view/src/View.php(206): Laminas\View\Renderer\PhpRenderer->render(NULL)
#2 /home/site/www/vendor/laminas/laminas-view/src/View.php(235): Laminas\View\View->render(Object(Laminas\View\Model\ViewModel))
#3 /home/site/www/vendor/laminas/laminas-view/src/View.php(199): Laminas\View\View->renderChildren(Object(Laminas\View\Model\ViewModel))
#4 /home/site/www/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(104): Laminas\View\View->render(Object(Laminas\View\Model\ViewModel))
#5 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Laminas\Mvc\MvcEvent))
#6 /home/site/www/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
#7 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(366): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
#8 /home/site/www/vendor/laminas/laminas-mvc/src/Application.php(347): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent))
#9 /home/site/www/index.php(21): Laminas\Mvc\Application->run()
#10 {main}

Any idea why? Thanks again. Greetings.

It would appear that $descripcion is a string, so you can’t call any methods on it. What you’ve posted doesn’t reveal where that comes from (the $body variable), but it’s probably a pretty simple case of either changing your code so you have the actual value object and not a string here, or just printing the string as-is and removing the “asHtml” call.

I will investigate it, although I am not sure why it worked with the previous version. I’ll put the solution here if I find it. Thanks and regards.