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:
2
NEWS
2
NEWS
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user