Problem/Motivation
When using PHP 8.1 I was getting the following warning.
Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in webform_requirements() (line 176 of modules/contrib/webform/includes/webform.install.requirements.inc).
webform_requirements('runtime')
call_user_func_array('webform_requirements', Array) (Line: 403)
Steps to reproduce
- Using Drupal 9.3.12
- With PHP 8.1
- Install webform module
- Create a new webform - but don't add any fields
- When viewing the config page (/admin/config) a warning is displayed
Proposed resolution
Check that $data['elements']is not null before using strpos
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform-strpos-php81-webform-requirements-3279930-2.patch | 672 bytes | 3li |
Comments
Comment #2
3liComment #3
liam morlandThis will fix it with no side-effects.
Perhaps the
isset()is not needed since$data['elements']is always set (it just might be NULL).Comment #6
jrockowitz commentedComment #7
drumm(disregard, updating to fix issue mis-indexing)
Comment #9
joseph.olstadpatch applies cleanly to 6.1.x also
Comment #10
mxr576Since 6.1.x is the current stable, supported, and covered by Drupal Security release, can we please have this fix backported to that version too?
Comment #11
jrockowitz commentedDone!
Comment #12
mxr576Thank you!
Comment #13
norman.lolCan't we get a tag for 6.1, please? 🙂