1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix missing deprecation message for default case statement followed by semicolon (#20172)

Follow-up to GH-19215
This commit is contained in:
Theodore Brown
2025-10-20 03:29:54 -05:00
committed by GitHub
parent 3472174583
commit c03215b623
3 changed files with 9 additions and 5 deletions

2
NEWS
View File

@@ -6,6 +6,8 @@ PHP NEWS
. Fixed bug GH-20113 (Missing new Foo(...) error in constant expressions).
(ilutov)
. Fixed bug GH-19844 (Don't bail when closing resources on shutdown). (ilutov)
. Fixed deprecation for default case statement followed by semicolon not
being emitted. (theodorejb)
- DOM:
. Fix getNamedItemNS() incorrect namespace check. (nielsdos)

View File

@@ -6333,6 +6333,11 @@ static void zend_compile_switch(zend_ast *ast) /* {{{ */
zend_ast *cond_ast = case_ast->child[0];
znode cond_node;
if (case_ast->attr == ZEND_ALT_CASE_SYNTAX) {
CG(zend_lineno) = case_ast->lineno;
zend_error(E_DEPRECATED, "Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead");
}
if (!cond_ast) {
if (has_default_case) {
CG(zend_lineno) = case_ast->lineno;
@@ -6343,11 +6348,6 @@ static void zend_compile_switch(zend_ast *ast) /* {{{ */
continue;
}
if (case_ast->attr == ZEND_ALT_CASE_SYNTAX) {
CG(zend_lineno) = case_ast->lineno;
zend_error(E_DEPRECATED, "Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead");
}
zend_compile_expr(&cond_node, cond_ast);
if (expr_node.op_type == IS_CONST

View File

@@ -38,6 +38,8 @@ switch ($a):
endswitch;
?>
--EXPECTF--
Deprecated: Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead in %s
Deprecated: Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead in %s
If: 11
While: 12346789