Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Election Page Error - The website encountered an unexpected error. Please try again later #11

Closed
trevorforrest876 opened this issue Sep 2, 2023 · 11 comments

Comments

@trevorforrest876
Copy link

Hello,
I am running Drupal 9.5.10
with CIVICRM version 5.64.0
Elections: Version 1.2.3

After the Election has been created and the page becomes visible the following error is seen on the page:

Test Election

This Election is currently in the Nominations phase.

You can submit nominations for this Election using the button below, and see existing nominations for each position. If you have been nominated for any positions, you can see these and have the option of withdrawing them. Nominations that require one or persons to second them will also be marked as such – press the "Need second" button to add your nominations

Nominations will close on September 4th, 2023 12:00 PM (GMT+00:00)

Existing Nominations
Nominations for President
The website encountered an unexpected error. Please try again later.

On viewing the Drupal logs the following error is seen in the logs:


Location https://example.com.com/civicrm/elections/view?eid=2
Referrer https://example.com.com/civicrm/elections
Message TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in include() (line 29 of /var/www/vhosts/example.com/private/civicrm/templates_c/en_US/%%63/633/6330B7D7%%nominations.tpl.php)
#0 /var/www/vhosts/example.com/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php(1914): include()
#1 /var/www/vhosts/example.com/private/civicrm/templates_c/en_US/%%AB/ABE/ABE5D1F1%%ViewElection.tpl.php(44): Smarty->_smarty_include()
#2 /var/www/vhosts/example.com/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php(1914): include('...')
#3 /var/www/vhosts/example.com/private/civicrm/templates_c/en_US/%%F7/F77/F77C7890%%CMSPrint.tpl.php(67): Smarty->_smarty_include()
#4 /var/www/vhosts/example.com/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php(1914): include('...')
#5 /var/www/vhosts/example.com/private/civicrm/templates_c/en_US/%%2B/2BD/2BD99720%%drupal8.tpl.php(6): Smarty->_smarty_include()
#6 /var/www/vhosts/example.com/vendor/civicrm/civicrm-packages/Smarty/Smarty.class.php(1273): include('...')
#7 /var/www/vhosts/example.com/vendor/civicrm/civicrm-core/CRM/Core/Smarty.php(205): Smarty->fetch()
#8 /var/www/vhosts/example.com/vendor/civicrm/civicrm-core/CRM/Core/Page.php(261): CRM_Core_Smarty->fetch()
#9 /var/www/vhosts/example.com/sites/default/files/civicrm/ext/au.com.agileware.elections/CRM/Elections/Page/Base.php(47): CRM_Core_Page->run()
#10 /var/www/vhosts/example.com/sites/default/files/civicrm/ext/au.com.agileware.elections/CRM/Elections/Page/ViewElection.php(66): CRM_Elections_Page_Base->run()
#11 /var/www/vhosts/example.com/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(319): CRM_Elections_Page_ViewElection->run()
#12 /var/www/vhosts/example.com/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#13 /var/www/vhosts/example.com/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#14 /var/www/vhosts/example.com/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke()
#15 /var/www/vhosts/example.com/modules/contrib/civicrm/src/Controller/CivicrmController.php(83): Drupal\civicrm\Civicrm->invoke()
#16 [internal function]: Drupal\civicrm\Controller\CivicrmController->main()
#17 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#18 /var/www/vhosts/example.com/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
#19 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#20 /var/www/vhosts/example.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#21 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
#22 /var/www/vhosts/example.com/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#25 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#26 /var/www/vhosts/example.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#27 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#28 /var/www/vhosts/example.com/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#29 /var/www/vhosts/example.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#30 /var/www/vhosts/example.com/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#31 /var/www/vhosts/example.com/index.php(19): Drupal\Core\DrupalKernel->handle()
#32 {main}

@agileware-justin
Copy link
Contributor

G'day Trev! What version of PHP?

@trevorforrest876
Copy link
Author

trevorforrest876 commented Sep 2, 2023 via email

@trevorforrest876
Copy link
Author

Hello following up on this issue. Is there a solution for this error Justin?

@trevorforrest876
Copy link
Author

Want to roll this out for a client and urgently need some help as it relates to this

@agileware-justin
Copy link
Contributor

We haven't tested this on PHP 8.2 or Drupal 9.x. So I am not surprised it is not working.

We have tested this on PHP 8.0 and WordPress - so I'd recommend using that environment. Which matches the environment that the client who currently sponsors this project uses.

@trevorforrest876
Copy link
Author

Unfortunately Wordpress is not an option for this or any of our clients we are a Drupal shop. There was little to no indication that this product only worked with wordpress, is there any way that updates can be made for it to work with drupal? everything seems to work all the way up to the generation of a page for the election voting etc.

@nickperkins
Copy link
Contributor

@trevorforrest876 FYI I have this working on Drupal 10.x with PHP 8.1 with the changes from #13

@trevorforrest876
Copy link
Author

@trevorforrest876 FYI I have this working on Drupal 10.x with PHP 8.1 with the changes from #13

Ok great......How do we get the updated version of this?

@nickperkins
Copy link
Contributor

@trevorforrest876 You'll need to wait for it to be merged into the codebase, or use the code from the PR but your mileage may vary.

@agileware-fj
Copy link

agileware-fj commented Feb 20, 2024

@trevorforrest876 I've put together a version that fixes this issue based on the work by @nickperkins in the branch CIVIELECT-53.

In my testing with newer PHP versions that show the issue you report, this new branch fixes the issue. Can you advise if it works for you?

@agileware-justin
Copy link
Contributor

Fixed in 1.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants