Account created on 16 September 2023, 10 months ago
#

Recent comments

I now see connections as a choice in the RedHen page and I believe this happened because of changes to permissions. I have a connection type defined. Whenever I try to view or create a connection I get this error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.redhen_connection' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "redhen_connection" "base_table") "subquery"; Array ( ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 266 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Drupal\Core\Database\StatementWrapperIterator->execute(Array, Array) (Line: 790)
Drupal\Core\Database\Connection->query('SELECT COUNT(*) AS "expression"
FROM
(SELECT 1 AS "expression"
FROM
{redhen_connection} "base_table") "subquery"', Array, Array) (Line: 525)
Drupal\Core\Database\Query\Select->execute() (Line: 266)
Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 316)
Drupal\Core\Entity\Query\QueryBase->initializePager() (Line: 245)
Drupal\Core\Entity\Query\Sql\Query->finish() (Line: 83)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 99)
Drupal\Core\Entity\EntityListBuilder->getEntityIds() (Line: 88)
Drupal\Core\Entity\EntityListBuilder->load() (Line: 241)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('redhen_connection')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

As I've continued to use the site there are additional places where ->accessCheck(FALSE); is missing and I believe needs to be added. I only hit the bug in one of these places but I believe its needed in them all.

- validate function in: redhen/modules/redhen_dedupe/src/Form/RedhenDedupeMergeForm.php
- redhenDedupeMerge function in: redhen/modules/redhen_dedupe/src/Form/RedhenDedupeMergeForm.php
- buildConfigurationForm function in: redhen/modules/redhen_connection/src/Plugin/Action/ChangeConnectionRole.php
- loadByMail function in: web/modules/contrib/redhen/modules/redhen_contact/src/Entity/Contact.php

After fixing those I encountered this error after creating an organization:

The website encountered an unexpected error. Please try again later.

TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, Drupal\Core\Link given in htmlspecialchars() (line 436 of core/lib/Drupal/Component/Utility/Html.php).
Drupal\Component\Utility\Html::escape(Object) (Line: 265)
Drupal\Component\Render\FormattableMarkup::placeholderEscape(Object) (Line: 216)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('You have not created any %bundle types yet. @link to add a new type.', Array) (Line: 195)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 471)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 239)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 187)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I think the fix is to apply the patch at: https://www.drupal.org/project/drupal/issues/3352384 ✨ Add Exception for TypeError Argument must be String in \Drupal\Component\Utility\Html escape{} Needs work but I haven't successfully done it yet.

I reviewed and the MR looks correct and those changes fix the errors on my site. I

As shown below, I added accessCheck(FALSE) line to the loadByUser function that threw the exception, uninstalled and reinstalled the modules and the problem didn't happen. I then turned on organizations and connections and got the fatal exception shown after the code.

public static function loadByUser($account, $status = TRUE) {
$contact = &drupal_static(__FUNCTION__ . $account->id(), FALSE);

// If we don't have a cached Contact and we have a uid to load the Contact
// by, proceed.
if (!$contact && !empty($account->id())) {

// Find Contacts linked to the current Drupal User.
$query = \Drupal::entityQuery('redhen_contact');
$query->accessCheck(FALSE);
$query->condition('uid', $account->id(), '=');
$query->condition('status', $status);
$results = $query->execute();

Fatal error: Declaration of Drupal\redhen_connection\Routing\RouteSubscriber::getSubscribedEvents() must be compatible with Drupal\Core\Routing\RouteSubscriberBase::getSubscribedEvents(): array in /var/www/html/web/modules/contrib/redhen/modules/redhen_connection/src/Routing/RouteSubscriber.php on line 66

Sorry, I haven't used drupal in many years and I've forgotten how to create an issue properly. I accidentally assigned it to myself then tried to un-assign it. I don't know what the fix is so it should be in needs-review or needs-work.

Production build 0.69.0 2024