This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 164381 - else if is not recognized in the same way as elseif
Summary: else if is not recognized in the same way as elseif
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomasz Slota
URL:
Keywords:
: 166504 167082 171782 172117 174282 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-04 13:32 UTC by Filip Zamboj
Modified: 2009-10-12 10:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Zamboj 2009-05-04 13:32:21 UTC
each else if is considered as else {if()...} what causes problems in indentation - see example below. workaround: use
elseif - else if should be implemented as a special case anyway. 
  
<?php
require_once("DBClass.php"); 
$db = new DB();
$db->_construct();

if (isset($_POST['ic_input'])) {
    $text = $_POST['ic_input'];
    
    if ($text == "") {
        return false;
    }
    else if (!is_numeric($text)) {
            echo "IC moze obsahovat len cisla!";
            return false;
        }
        else if (strlen($text) < 8 ) {
                echo "Text je prilis kratky";
                return false;
            } 
            elseif (strlen($text) > 8 ) {
                echo "Text je prilis dlhy";
                return false;
            } 
            else {
                $db->testForExistingIC('');
                return true;
            }

}
?>
Comment 1 Tomasz Slota 2009-05-19 09:07:02 UTC
confirmed. The current behavior is correct judging by the syntax, but I agree that most users would expect the formatter to behave the same as in case of 
elseif
Comment 2 Tomasz Slota 2009-06-04 10:06:06 UTC
*** Issue 166504 has been marked as a duplicate of this issue. ***
Comment 3 Tomasz Slota 2009-08-18 13:04:14 UTC
*** Issue 167082 has been marked as a duplicate of this issue. ***
Comment 4 Tomasz Slota 2009-09-14 10:04:49 UTC
Upgrading to P2 due to a number of duplicates
Comment 5 Tomasz Slota 2009-09-14 10:06:12 UTC
*** Issue 172117 has been marked as a duplicate of this issue. ***
Comment 6 Tomasz Slota 2009-09-14 10:07:14 UTC
*** Issue 171782 has been marked as a duplicate of this issue. ***
Comment 7 Tomasz Slota 2009-09-24 14:21:49 UTC
fixed & unit tested

http://hg.netbeans.org/web-main/rev/c4c17236550d
Comment 8 Quality Engineering 2009-09-26 21:06:40 UTC
Integrated into 'main-golden', will be available in build *200909251401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c4c17236550d
User: Tomasz Slota <tslota@netbeans.org>
Log: #164381: else if is not recognized in the same way as elseif
Comment 9 Filip Zamboj 2009-09-29 12:32:24 UTC
verified in 
Product Version: NetBeans IDE 6.8 Beta (Build 200909281634)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
Comment 10 Tomasz Slota 2009-10-12 10:15:49 UTC
*** Issue 174282 has been marked as a duplicate of this issue. ***