Problem/Motivation

For PHP 8.0, when we add a new webform and clicked on the conditional
Click on add a new condition (+) , then it is not showing default conditions instead it is just loading weight.

Steps to reproduce

1. Change the version to PHP 8.0,
2. Add a new webform and clicked on the conditional
3. Click on add a new condition (+) , then it is not showing default conditions instead it is just loading weight.
4. Repeat the same with PHP 7.4 and see the difference.

Issue fork webform-3299953

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajkumar7it74 created an issue. See original summary.

saurabh rawat’s picture

I am also facing same issue.

sadman’s picture

Experiencing the same issue with adding new conditionals after updating to PHP 8.0 There are no errors logged to Apache, PHP or Watchdog. There are no errors or warnings in the browser console that didn't appear with PHP 7.4. It doesn't seem to break existing conditions. It seems to be a broken UI for administering them.

liam morland’s picture

Version: 7.x-4.24 » 7.x-4.x-dev
Issue tags: +PHP 8.0

Can you explain in more detail what "it is just loading weight" means?

jdelon02’s picture

StatusFileSize
new54.08 KB

I am having the same issue. Attached is a screenshot of "just loading weight"

bradallenfisher’s picture

Yep can confirm this is definitely a PHP 8 thing. On my local PHP 7.4 it does not occur but on acquia cloud PHP 8.0 we can no longer add new conditionals.

liam morland’s picture

Are there any error messages, either for PHP or in the browser console?

saurabh rawat’s picture

Yes, This is definitely PHP issue, when with same module I try with PHP 7.4 version, it works properly but when I upgrade xampp version to php 8 then this issue is coming.
and there is no error message coming in browser and PHP.

loon’s picture

Assigned: Unassigned » loon

loon’s picture

Assigned: loon » Unassigned
Priority: Normal » Critical
Status: Active » Needs review

It's php8 related issue. The max() contain non-numeric and integer values and according to php doc -
Caution
Be careful when passing arguments of different types because max() can produce unpredictable results.

The following code
max(array(0, 1, 2, 'new'));

will return int(2) but since PHP 8.0 above code returns string("new")

liam morland’s picture

It would be great to get a test that would catch this. Under what circumstances is there a non-numeric rgid?

loon’s picture

@Liam Morland
We have 'new' key by default, see webform_conditionals_form(). Any new conditionals will have a numeric key

solideogloria’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed the issue with PHP 8.0, and the merge request fixes it.

  • Liam Morland committed 86fbd79 on 7.x-4.x authored by loon
    Issue #3299953: Remove non-numeric parameters to max() for PHP 8.0...
liam morland’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

Status: Fixed » Closed (fixed)

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