Reviewed & tested by the community
Project:
Service links
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Sep 2019 at 02:22 UTC
Updated:
23 Jan 2023 at 13:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hargobindSingle line fix.
Comment #3
wylbur commentedAdding the PHP 7.3 tag to track this issue. Will test the patch - tomorrow!
Comment #4
wylbur commentedWe experienced this error when we started testing a Drupal 7 site using PHP 7.3.
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? service_links_sprites.module:85Applying the patch in comment #2 resolved the issue.
Marking this as RTBC, but I encourage others that find this issue to also test.
Specifics:
Drupal 7.69
PHP 7.3
Service Links 7.x-2.4
Comment #5
wylbur commentedComment #6
wylbur commentedComment #7
mforbes commentedI haven't tested the patch yet so I don't mean to say it's wrong, but I just have a question:
Isn't the message basically saying "you're using x which results in execution like y; did you instead mean z"? Therefore if we want a patch to result in no change of execution behavior -- and I assume we want no change in behavior since nothing in this issue mentions buggy logic -- then the patch should replace x with y. The current patch (#2) is replacing x with z instead.
Comment #8
hargobind@mforbes:
Looking at this specific code, the
switch {}is contained in afor {}loop, and there is additional code after theswitch {}statement. That remaining code relies on a variable that is only set in theswitch {}.It appears that the
continuewas meant to skip the code after theswitch {}and move on to the next iteration of thefor {}loop. Instead, thecontinue(without "2") acts like abreakstatement which only halts theswitch {}execution but continues to execute the rest of the code in thefor {}loop.If we let execution continue to run on the remaining code in the
for {}, it will cause an error. So this patch actually keeps the original intended logic.Comment #9
paulrooney commentedI confirm that the patch in comment #2 resolves the issue.
Drupal 7.72
PHP 7.3
Service Links 7.x-2.4
Comment #10
hargobindThanks @paulrooney.
Adding PHP 7.4 issue tag for better visibility.
Comment #11
chikeUsing PHP 7.4, patch #2 solved the issue.