Skip to content

Commit 5bb7c95

Browse files
committed
Fix missing deprecation message for default case statement followed by semicolon
Follow-up to phpGH-19215
1 parent 19a1600 commit 5bb7c95

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Zend/zend_compile.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6340,6 +6340,10 @@ static void zend_compile_switch(zend_ast *ast) /* {{{ */
63406340
"Switch statements may only contain one default clause");
63416341
}
63426342
has_default_case = 1;
6343+
if (case_ast->attr == ZEND_ALT_CASE_SYNTAX) {
6344+
CG(zend_lineno) = case_ast->lineno;
6345+
zend_error(E_DEPRECATED, "Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead");
6346+
}
63436347
continue;
63446348
}
63456349

tests/lang/033.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ switch ($a):
3838
endswitch;
3939
?>
4040
--EXPECTF--
41+
Deprecated: Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead in %s
42+
4143
Deprecated: Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead in %s
4244
If: 11
4345
While: 12346789

0 commit comments

Comments
 (0)