I wanted to test the latest version of ECA in a fresh install of Drupal 9.3.0. I've first composer required ECA 1.0.x-dev. bpmn_io 1.0.x-dev and Context Stack Beta1.

I've then selected ECA Core, ECA Content, ECA BPMN, ECA Base and BPMN.IO for ECA on the Extend page and hit install. Then I got the notice that Context Stack is a dependency and it is getting installed as well. Which lead right into the following fatal error:

Fatal error: Method Drupal\context_stack\ContextStackTrait::__sleep() cannot take arguments in /var/www/html/web/modules/contrib/context_stack/src/ContextStackTrait.php on line 157

When checking the Extend page afterwards Context Stack is shown installed while the other modules (ECA Core, ECA Content, ECA BPMN, ECA Base and BPMN.IO for ECA) are shown as not installed. I've then uninstalled Context Stack and composer required Context Stack 1.0.x-dev.

I've then went back to the Extend page and only selected Context Stack to install. But again I ran into the identical fatal error from before.

CommentFileSizeAuthor
#3 contextstacktrait_sleep.pdf72.15 KBrkoller

Comments

rkoller created an issue. See original summary.

mxh’s picture

Thanks for the bug report. Please give some details about your app environment, specifically

  • used PHP version

If available, please provide a full trace of the logged error. The one-liner doesn't help me reproducing the problem.

Patches that fix the problem are always welcome.

rkoller’s picture

StatusFileSize
new72.15 KB

I am running the install locally in DDEV. The project is set to PHP 8.0.13, nginx/1.20.2 and mysql Ver 15.1 Distrib 10.5.12-MariaDB. After a restart the fatal error is happening on every page load now. So i am unable to access the logging settings.
Unfortunately I am not a developer and never performed a full trace (also uncertain if it is still possible at this point when every page is leading to a white screen). But i've tried the following. Activated xdebug in ddev and added xdebug_start_trace() in line 157 and xdebug_stop_trace() in line 185 of the ContextStackTrait.php file(see contextstacktrait_sleep.pdf). Please let me know if that helps and is what you were looking for or if i have to target other parts of the code.

and i did one additional test since you've asked about the php version i am using in particular. i've changed the php version from 8.0.13 to 7.4.26 for the ddev project. after a restart the fatal error was gone.

mxh’s picture

I just want to see the full error message, it's usally logged with its stack trace already within the webserver logs. But thanks for trying to get to the trace :)
I'll try to reproduce the error by using your mentioned PHP version, it's probably a change between the major PHP versions that now doesn't like arguments on magic methods anymore.

mxh’s picture

Confirming that this error is coming from a change introduced in PHP8: https://wiki.php.net/rfc/magic-methods-signature

Will fix the wrong signatures.

  • mxh committed 8c15bb0 on 1.0.x
    Issue #3256973 by rkoller, mxh: When trying to install ECA or Context...

  • mxh committed 15910f1 on 1.0.x
    Issue #3256973 by rkoller, mxh: When trying to install ECA or Context...
mxh’s picture

Status: Active » Needs review

I fixed the wrong signatures. If you have some time, I'd highly appreciate a review from you by testing the latest state of 1.0.x-dev.

rkoller’s picture

Status: Needs review » Needs work

While being on 7.4.26 I've uninstalled all ECA modules and Context Stack. I've then set the error message display to "All messages, with backtrace information" for the site. When you've pushed your two commits to the dev branch I've changed back to 8.0.13 and then tried to install the ECA modules and Context Stack modules at once that lead to the fatal error before. It is working now without any complaints.

But I've did one last check and tried to uninstall all the aformentioned modules again. The ECA and bpmn.io related uninstalled without any complaints. But Context Stack ran into an error (is that the kind of stack trace you were looking for which is more helpful in contrast to the one i've posted yesterday?):

The website encountered an unexpected error. Please try again later.
AssertionError: Failed to assert that "context_stack:account:5dc9b6442bc7569777ce3c3da63d8a11" are valid cache contexts. in assert() (line 31 of core/lib/Drupal/Core/Cache/Cache.php).
assert(, 'Failed to assert that "context_stack:account:5dc9b6442bc7569777ce3c3da63d8a11" are valid cache contexts.') (Line: 31)
Drupal\Core\Cache\Cache::mergeContexts(Array, Array) (Line: 33)
Drupal\Core\Cache\CacheableMetadata->addCacheContexts(Array) (Line: 69)
Drupal\context_stack\ContextCollection->getCacheContexts() (Line: 171)
Drupal\Core\Cache\CacheableMetadata::createFromObject(Object) (Line: 129)
Drupal\context_stack\ContextStack->pop() (Line: 103)
Drupal\context_stack\EventSubscriber\ContextStackControllerWrapperSubscriber->onKernelRequestFinish(Object, 'kernel.finish_request', Object)
call_user_func(Array, Object, 'kernel.finish_request', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.finish_request') (Line: 207)
Symfony\Component\HttpKernel\HttpKernel->finishRequest(Object, 1) (Line: 193)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 245)
Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 91)
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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I'll set the issue to needs work - but not sure if the error is related to the wrong signatures and the newly introduced changes or if it is unrelated.

mxh’s picture

Thanks for the review.

(is that the kind of stack trace you were looking for which is more helpful in contrast to the one i've posted yesterday?):

Yes exactly, thanks!

Could you maybe test it once more, without changing environment settings or anything like that, just navigate through /admin/modules and use the installation and uninstallation process there? And if you encounter the above noted error again, please give me the steps how I can reproduce the error, as I'm currently having a hard time trying to reproduce that error.

rkoller’s picture

hm i haven't changed anything. the only change to the environment was by switching back to php 8.0.13 and by changing the error display. aside that i haven't changed anything. or do you refer to something else in regards of changing the environment settings?

and the steps are straightforward and are reproducible ( i am able to install and uninstall context stack again and again and the error takes place on uninstall - tried now 6 times in a row overall always the identical result). the steps:
- if you are on admin/modules and neither ECA, bpmn.io nor Context Stack is installed simply select Context Stack and install the module
- go to admin/modules/uninstall and select context stack and uninstall
- confirm the uninstall
- the aforementioned error takes place but i am able to go directly to admin/modules/ again (just pasted the path in the addressbar) and get the status message that the selected modules have been uninstalled (even though the error page turned up)

additionally i've tried something else afterwards:
- reinstalled the context stack module and went to admin/modules/uninstall, then did a drush cr (since the error message is about caching), then selected the context stack module for uninstall, confirmed the uninstall and the error showed up again. :/

mxh’s picture

Status: Needs work » Fixed

I cannot reproduce the error using a standard installation profile of D9.3 with PHP 7.4, installing Context Stack via UI and uninstalling right afterwards. I debugged the assertion code and it doesn't assert to be false, neither when clicking on confirmation button nor after the module got uninstalled.

Some factors that might lead to our different obersvations:

  • Used PHP version - is the error also showing up using PHP 7.4, or only when using PHP8?
  • Other installed modules that are not by default installed when using the standard installation profile. If you have a bunch of modules installed, feel free to share your list of installed modules (resided within exported core.extension.yml).

Marking this one here as fixed, will create a follow-up issue regarding the error in #9.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.