Bug #67757 [Opn]: multiple default cases

[email protected]
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=67757&edit=1

 ID:                 67757
 Updated by:         [email protected]
 Reported by:        php at tutteli dot ch
 Summary:            multiple default cases
 Status:             Open
 Type:               Bug
-Package:            *General Issues
+Package:            PHP Language Specification
 PHP Version:        5.5.15
 Block user comment: N
 Private report:     N

 New Comment:

This is probably an issue with the spec, then: AIUI, the spec should be documenting what 5.6 does at present.


Previous Comments:
------------------------------------------------------------------------
[2014-08-04 12:31:30] php at tutteli dot ch

Description:
------------
PHP allows to define multiple default cases in a switch. According to the spec this should not be allowed:
https://github.com/php/php-langspec/blob/master/spec/11-statements.md#the-s
witch-statement


Test script:
---------------
<?
$a=1;
$b=0;
switch($a) {
  default:
    $b += 1;
    break;
  default:
    $b += 2;
}
echo $b; //output would be 2
?>

Expected result:
----------------
parser syntax error



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67757&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.