#6 No check for closing bracket in SWITCH block

Closed
opened 2 years ago by belliash · 1 comments
belliash commented 2 years ago
Owner

Aer Information

  • Aer Version (or commit ref): 6abb65a04c
  • Operating System: Linux
  • System Architecture (eg. arm, x86_64, ...): x86_64

Your problem description

Switch block does not need closing bracket or 'endswitch' statement. If this is missing, all other code is omitted.

<?php
    $x = 1;
    switch($x) {
        case 1:
            echo '1';
        case 2:
            echo '2';
            break;
        case 3:
            echo '3';
            break;
        default:
            echo 'N';
            break;

echo $x;
?>

Expected results

Above code snippet should not compile due to missing ending bracket.
Same problem occurs when SWITCH: (...) ENDSWITCH construct is used. Currently PH7 Engine checks only if both structures are not mixed together, ie. switch() { endswitch.

Current results

Presented code snippet, outputs "12" as expected, and everything after switch block is omitted. Last echo does not give any output.

<!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please take a moment to check that your issue doesn't already exist. 3. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> # Aer Information - Aer Version (or commit ref): 6abb65a04c - Operating System: Linux - System Architecture (eg. arm, x86_64, ...): x86_64 # Your problem description Switch block does not need closing bracket or 'endswitch' statement. If this is missing, all other code is omitted. <?php $x = 1; switch($x) { case 1: echo '1'; case 2: echo '2'; break; case 3: echo '3'; break; default: echo 'N'; break; echo $x; ?> # Expected results Above code snippet should not compile due to missing ending bracket. Same problem occurs when SWITCH: (...) ENDSWITCH construct is used. Currently PH7 Engine checks only if both structures are not mixed together, ie. switch() { endswitch. # Current results Presented code snippet, outputs "12" as expected, and everything after switch block is omitted. Last echo does not give any output.
belliash added the
bug
label 2 years ago
belliash self-assigned this 2 years ago
belliash referenced this issue from a commit 2 years ago
belliash commented 2 years ago
Poster
Owner

Fixed in ae2c1e2ae5.

Fixed in ae2c1e2ae5.
belliash closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.