Project

General

Profile

Bug #9365

Use of "continue" in switch statements can be ambiguous

Added by Jim Pingle 8 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
PHP Interpreter
Target version:
Start date:
03/05/2019
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.5.0
Affected Architecture:
All

Description

PHP 7.3 is tightening down on the use of continue in switches. There are instances where the code meant to continue through a foreach or other loop but didn't have the right number set on continue statements, which made them equivalent to a break which was most likely not what was intended.

http://php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch

Below are the errors spotted so far. Add more in comments.

PHP Warning:  "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in /etc/inc/gwlb.inc on line 747
PHP Warning:  "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in /etc/inc/gwlb.inc on line 889
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/pkg/frr/inc/frr_zebra.inc on line 211
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/pkg/frr/inc/frr_zebra.inc on line 572

Associated revisions

Revision 05221142 (diff)
Added by Jim Pingle 8 months ago

Target the proper loop in switch statements. Issue #9365

Revision 59449ddb (diff)
Added by Jim Pingle 8 months ago

Fix deeper continues. Issue #9365

Revision 86ec819a (diff)
Added by Jim Pingle 8 months ago

Target the proper loop in switch statements. Issue #9365

History

#1 Updated by Jim Pingle 8 months ago

  • Subject changed from Use of "continue" in switches can be ambiguous to Use of "continue" in switch statements can be ambiguous
  • Affected Version set to 2.5.0

#2 Updated by Jim Pingle 8 months ago

Two more:

PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/www/interfaces.php on line 2644
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/www/system.php on line 142

#3 Updated by Jim Pingle 8 months ago

  • Category changed from Unknown to PHP Interpreter

#4 Updated by Steve Wheeler 7 months ago

Seeing in lcdproc too. Seems to be working OK though.

[19-Mar-2019 19:07:01 Europe/London] PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/pkg/lcdproc.inc on line 83
[19-Mar-2019 19:07:01 Europe/London] PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/pkg/lcdproc.inc on line 102
[19-Mar-2019 19:07:01 Europe/London] PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/local/pkg/lcdproc.inc on line 118

#5 Updated by Jim Pingle 7 months ago

I just pushed a fix for the lcdproc errors. Looks like those continue statements were unnecessary and could be removed.

#6 Updated by Jim Pingle 5 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

All the ones we have found so far are now fixed. If new ones pop up, open new issues for them.

Also available in: Atom PDF