Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I was looking through the recent log messages and found this error.
Steps to reproduce
Error: Class 'Zend\Diactoros\Response\RedirectResponse' not found in Drupal\business_rules\Controller\ConditionsItemsController->addItem() (Zeile 137 in drupal/modules/contrib/business_rules/src/Controller/ConditionsItemsController.php)
#0 [internal function]: Drupal\business_rules\Controller\ConditionsItemsController->addItem()
#1 drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
Proposed resolution
Replace it with
use Laminas\Diactoros\Response\RedirectResponse;
Remaining tasks
* Replace it with
use Laminas\Diactoros\Response\RedirectResponse;
* Create a patch or release new version.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3250592-class-redirect-response-missing.patch | 2.61 KB | Eugen Zerr |
Comments
Comment #2
Eugen ZerrHere is a patch that fixes it for me.
Comment #3
Eugen ZerrComment #4
Eugen ZerrComment #5
Duvan.Slabbert CreditAttribution: Duvan.Slabbert commentedEnvironment:
Drupal : 9.3.0
PHP : 8
dBug for Drupal : 2.0.0
Business Rules : 2.0.0-beta1
Solution #2 worked for me.
Comment #6
Eugen ZerrComment #7
lexsoft CreditAttribution: lexsoft commentedSolution #2 worked for me.
+1 to get this committed!
Comment #8
ldwyer CreditAttribution: ldwyer as a volunteer commentedI first noticed this error message when I was trying to add an action to a condition. Solution #2 did get rid of the error, but if I try to add an action to a condition is doesn't apply. It doesn't err anymore, but it also doesn't save the action to the condition. Is anyone else experiencing this?
Drupal: 9.3.3
PHP: 8.0.15
Business Rules: 2.0.0-beta1
DBug: 2.0.0
Comment #9
lexsoft CreditAttribution: lexsoft commentedIt works for me
Drupal Version
9.3.2
Web Server
nginx/1.20.2
PHP
Version7.4.26
Please find all the patches I use for the latest business_rules in composer.json:
Comment #10
Kris77 CreditAttribution: Kris77 as a volunteer commentedPatch #2 worked for me too.
Thanks @Eugen Zerr
Comment #11
gilbertdelyon CreditAttribution: gilbertdelyon commentedPatch #2
get rid of error
but no action loaded
== #8
This module is promissing but I am afraid of its Long Term usability. Still in Beta after nearly a year .
Comment #12
markdcSame problem as #8 and #11.
Drupal: 9.3.7
PHP: 7.4.28
Business Rules: 2.0.0-beta1
Comment #13
Riki72 CreditAttribution: Riki72 commentedSame problem as #8, #11 and #12.
Drupal: 9.3.9
PHP: 7.4.28
Business Rules: 2.0.0-beta1
DBug: 2.0.0
Solution #2 did get rid of the error, but if I try to add an action to a condition is doesn't apply.
with this issue module is not usable, please fix it soon as possible.
Comment #14
cweldon CreditAttribution: cweldon at VTM Group commentedApplying path #2 and the patch from https://www.drupal.org/project/business_rules/issues/3200711 worked for me on Drupal 9.3.11, PHP 8.1.5.
Comment #15
er_abhinav CreditAttribution: er_abhinav at Evolving Web commentedI am facing same issue as https://www.drupal.org/project/business_rules/issues/3250592#comment-143...
Comment #16
calinh CreditAttribution: calinh commented#2 worked ok for me. I could add the action. Drupal core 9.4.4, PHP 7.4
Thank you.
Comment #17
Eugen ZerrHello Everyone,
my fix just adds a class to prevent breaking the page.
It doesn't fix other problems e.g. as in #8, #11 and #12.
For those errors please create an extra issue so it can be handled separately.
Also don't forget to add a detailed way on how to reproduce the error as not everyone knows how to use the module.
Comment #18
apadernoThe person who provided the patch/MR cannot change the status to Reviewed & tested by the community.
Comment #19
lexsoft CreditAttribution: lexsoft commentedComment #20
apadernoI am changing back the status, since no explanation has been given for the status change.
Comment #21
lexsoft CreditAttribution: lexsoft commented@apaderno
I've tested the patch on a production application using business_rules at it's core with no issues so far. I've thought it would be good to close it as it's been a year and would like to push for a next release as explained in #3261552: Business Rules 2.0.0-beta2 release plan D10 compatible
Comment #22
apaderno@lexsoft Changing the status to Reviewed & tested by the community does not close the issue, which is closed when the project files are changed.
Changing the status without saying why the status is changed does not help maintainers, who would still need to understand why the status was changed and check whether the patch/MR is correct.
Comment #23
apadernoSince the module uses
core_version_requirement: ^8 || ^9
, changing the used class is not sufficient, as Drupal 8 core does not have any Laminas class as requirement.If there is still the need to have a branch compatible with Drupal 8, a new branch must be created; otherwise the
core_version_requirement: ^8 || ^9
line must be changed too.Comment #24
leymannxYope, we need
laminas/laminas-diactoros
in a composer.json.Comment #26
rcodina CreditAttribution: rcodina at Seidor commentedFixed on a new branch 3.x. The `laminas/laminas-diactoros` will be added via #3261552: Business Rules 2.0.0-beta2 release plan D10 compatible.