Problem/Motivation
Deprecated function: strcasecmp(): Passing null to parameter #1 ($string1) of type string is deprecated in webform_conditional_operator_string_equal() (line 1548 of .../webform/includes/webform.conditionals.inc).
Steps to reproduce
function webform_conditional_operator_string_equal($input_values, $rule_value) {
foreach ($input_values as $value) {
// Checkbox values come in as 0 integers for unchecked boxes.
$value = ($value === 0) ? '' : $value;
if (strcasecmp($value, $rule_value) === 0) {
return TRUE;
}
}
return FALSE;
}
The assertion Checkbox values come in as 0 integers for unchecked boxes. is not entirely complete. For radio buttons, if none of the options are selected, the value sent is NULL, not zero.
Proposed resolution
Instead of
$value = ($value === 0) ? '' : $value;
Use this:
$value = ($value === 0 || $value === NULL) ? '' : $value;
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #3
solideogloria commentedComment #4
joseph.olstadhmm, very strange as to why there's 10 fails, perhaps an upstream issue, perhaps need a no_change patch to test against to kick HEAD around.
Comment #5
liam morlandIs there a reason not to use
empty()?The test failure is likely due to #3194156: Patches and Merge Requests lead to different test results. Unfortunately, getting tests to pass often requires uploading a patch.
Comment #6
solideogloria commented'0'is empty but should not return an empty string. Honestly, I think use of theempty()function should be avoided in most cases due to its weird behavior.Comment #7
solideogloria commentedThis is the patch from the MR
Comment #9
liam morlandThanks!
Comment #10
poker10 commentedThanks @Liam Morland! Would it be possible to publish a new 7.x-4.x release with all these PHP 8 compability fixes sometime soon?
Comment #11
joseph.olstadYes nicely done @Liam Morland, please tag and push a new release with these fixes.

Comment #12
joseph.olstadAlso, I recommend setting PHP 8.2 as the issue testing default.
Comment #13
liam morlandI'm just waiting for 2 weeks to pass since the last issue was marked fixed. Two more days.
I plan to upgrade the default testing PHP version once 8.2 is more widely used and I can be more confident there will not be regressions in compatibility. Currently, D7 core is not automatically tested on PHP 8.2; it's default is PHP 7.4.
Comment #14
joseph.olstadwebform_localization automation tests for PHP 8.2.x led me to create this:
#3333988: PHP 8.2 compatibility fix
It's a harmless change, I think it'll do the trick.
Comment #15
joseph.olstadI'm not sure if webform_localization is loading the dev branch of webform as a dependency or the tagged release, it might be choking on the old tagged release.
A new tagged release would likely help also but ya see if you can add this first:
#3333988: PHP 8.2 compatibility fix
Comment #16
liam morlandTesting uses the latest full release tag. That is probably the problem. If this is still a problem after a new full release is made, please re-open.
I do not think this patch does anything because NULL is the default value.
Please do not RTBC your own patches.
Comment #17
liam morland