No check for closing bracket in SWITCH block #6

Closed
opened 2018-07-15 14:24:49 +02:00 by belliash · 1 comment
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 2018-07-15 14:24:49 +02:00
belliash self-assigned this 2018-07-24 15:38:05 +02:00
belliash referenced this issue from a commit 2018-07-24 16:15:52 +02:00
Author
Owner

Fixed in ae2c1e2ae5.

Fixed in ae2c1e2ae5.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: aerscript/Aer#6
No description provided.