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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Eugen Zerr created an issue. See original summary.

Eugen Zerr’s picture

Here is a patch that fixes it for me.

Eugen Zerr’s picture

Status: Active » Needs review
Eugen Zerr’s picture

Duvan.Slabbert’s picture

Environment:
Drupal : 9.3.0
PHP : 8
dBug for Drupal : 2.0.0
Business Rules : 2.0.0-beta1

Solution #2 worked for me.

Eugen Zerr’s picture

Status: Needs review » Reviewed & tested by the community
lexsoft’s picture

Solution #2 worked for me.

+1 to get this committed!

ldwyer’s picture

I 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

lexsoft’s picture

It 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:

     "patches": {     
          "drupal/business_rules": {
                "Issue #3239152: Drupal 9 - Deprecated code": "https://www.drupal.org/files/issues/2021-10-29/deprecated-entity-query-3239152-4.patch",
                "Issue #3200711: cannot add an action to a condition": "https://www.drupal.org/files/issues/2021-05-15/cannot_add_action-3200711-29.patch",
                "Issue #3123554: Execution of scheduled tasks is completely broken": "https://www.drupal.org/files/issues/2021-08-13/business_rules-schedule_task_execution_broken-3123554-11.patch",
                "Issue #3056302: Variables placed in email body not being replaced with actual value\n": "https://www.drupal.org/files/issues/2020-01-21/collect_variables-3056302-11.patch",
                "Issue #3087989: Duplicate condition": "https://www.drupal.org/files/issues/2020-02-06/duplicate-condition-3087989-3.patch",
                "Issue #3250592: Class RedirectResponse not found": "https://www.drupal.org/files/issues/2021-11-22/3250592-class-redirect-response-missing.patch",
            }
       }
Kris77’s picture

Patch #2 worked for me too.

Thanks @Eugen Zerr

gilbertdelyon’s picture

Patch #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 .

markdc’s picture

Same problem as #8 and #11.

Drupal: 9.3.7
PHP: 7.4.28
Business Rules: 2.0.0-beta1

Riki72’s picture

Same 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.

cweldon’s picture

Applying 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.

er_abhinav’s picture

calinh’s picture

#2 worked ok for me. I could add the action. Drupal core 9.4.4, PHP 7.4
Thank you.

Eugen Zerr’s picture

Hello 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.

apaderno’s picture

Assigned: Eugen Zerr » Unassigned
Status: Reviewed & tested by the community » Needs review
Issue tags: -

The person who provided the patch/MR cannot change the status to Reviewed & tested by the community.

lexsoft’s picture

Status: Needs review » Reviewed & tested by the community
apaderno’s picture

Version: 2.0.0-beta1 » 2.x-dev
Status: Reviewed & tested by the community » Needs review

I am changing back the status, since no explanation has been given for the status change.

lexsoft’s picture

@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

apaderno’s picture

@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.

apaderno’s picture

Status: Needs review » Needs work

Since 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.

leymannx’s picture

Yope, we need laminas/laminas-diactoros in a composer.json.

  • rcodina committed be70addc on 3.x authored by Eugen Zerr
    Issue #3250592 by Eugen Zerr, lexsoft, apaderno, leymannx: Class...
rcodina’s picture

Status: Needs work » Fixed

Fixed 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.

Status: Fixed » Closed (fixed)

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