Closed (fixed)
Project:
Webform
Version:
6.1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2022 at 17:20 UTC
Updated:
23 Jun 2023 at 19:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
anagomes commentedHi @bletch! Can you provide the steps to reproduce this error?
Comment #3
bletch commentedI did not replace strpos with str_contains because it looks like webform is still supporting PHP 7 in this version. If it is not, and you want to use str_contains please let me know and I will update. Apart from that, this is a pretty straightforward check to stop the deprecation notice.
Comment #5
jrockowitz commentedWould it be simpler to just make sure the query string is not NULL?
$query_string = $request->getQueryString() ?? '';Comment #6
jrockowitz commentedThis might be the simplest approach.
Comment #7
bletch commentedI prefer not doing the multiple null checks as I find it less elegant. I also renamed $querystring as it is not a string but an array. Small detail but just improvements in readability (at least from my perspective). Everyone has different opinions on this though, so module maintainers should do whatever they feel is most appropriate for their modules.
Comment #8
murilohp commentedHey @jrockowitz first time here, and giving my two cents on this. Your patch is definitely a simplest approach, I would actually suggest something like:
if (strpos((string) $request->getQueryString(), '_wrapper_format=') === FALSE) {Looking deeper at the
Requestcomponent on SF, thegetQueryString()method will always returnNULLor string, this way we just cast it and it will be ''. But I'm also ok with the solution on #6.About #7, I agree with @bletch about renaming the $querystring, it's the best for keeping things consistent. But I don't think this is part of the scope of the issue, I know it's something minor, but the idea here is fix the deprecation message. I think IMHO, we should create a new issue to address this.
What do you think?
Comment #9
jrockowitz commentedI think exiting
\Drupal\webform_ui\PathProcessor\WebformUiPathProcessor::processOutboundas early as possible is the best solutions.Renaming
$querystringto just$querymakes sense and aligns with Drupal core's use of$query.Comment #10
murilohp commentedNo worries @jrockowitz! The patch looks good and
$queryseems to be the best naming option.Comment #12
jrockowitz commentedComment #16
connbi commentedComment #17
joseph.olstadPatch #16 is good, this is needed @jrockowitz
Comment #18
nathan tsai commentedGetting dozens of:
Just applied the patch and it appears to fix the issue.
One question: should the check simply be falsey or something like
!empty($path)or!is_null($path).Comment #19
camilo.escobar commentedThis was an issue until version 6.1.4, where the patch in #16 had to be applied. Updating to 6.1.5 will solve this problem and the patch will not be necessary, since the same issue was tackled with a different approach in https://www.drupal.org/project/webform/issues/3333461 and https://www.drupal.org/project/webform/issues/3344996.