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 222774 - Formatting PHP code causes code to be commented out and may or may not still compile
Summary: Formatting PHP code causes code to be commented out and may or may not still ...
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2012-11-26 16:06 UTC by tjchambers
Modified: 2012-12-06 09:31 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (36.37 KB, text/plain)
2012-11-26 16:06 UTC, tjchambers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tjchambers 2012-11-26 16:06:28 UTC
Product Version = NetBeans IDE Dev (Build 201211240959)
Operating System = Mac OS X version 10.8.2 running on x86_64
Java; VM; Vendor = 1.6.0_37
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.12-b01-434


Following code:
<?php

if (1 == 2  // false 
	|| 1 == 1)  // true
	echo "this is true";
?>


Reproduce: 
- Enter code into Netbeans PHP IDE
- Format code
- Resulting code does not compile any longer!

<?php

if (1 == 2  // false  || 1 == 1)  // true
	echo "this is true";
?>

Even worse!!!

Following code:
<?php

if (1 == 2  // false 
	|| 1 == 1  // true
		)
	echo "this is true";
?>

Reproduce: 
- Enter code into Netbeans PHP IDE
- Format code
- Resulting code DOES compile BUT has now lost ACTIVE CODE!
<?php

if (1 == 2  // false  || 1 == 1  // true
)
	echo "this is true";
?>
Comment 1 tjchambers 2012-11-26 16:06:31 UTC
Created attachment 128408 [details]
IDE log
Comment 2 Ondrej Brejla 2012-11-26 16:11:04 UTC
Reproducible.
Comment 3 Ondrej Brejla 2012-11-26 16:13:20 UTC
Comments should be handled properly... I'll look at it. Thanks for reporting.
Comment 4 Ondrej Brejla 2012-11-26 16:14:32 UTC
Sry, probably P2.
Comment 5 tjchambers 2012-11-26 16:17:07 UTC
P2 would be my vote. My code ended up in production after being commented out and a test did not catch the regression. Very dangerous.
Comment 6 Ondrej Brejla 2012-11-27 10:59:54 UTC
Fixed in web-main #6d636962d3c0
Comment 7 Quality Engineering 2012-11-30 02:51:32 UTC
Integrated into 'main-golden', will be available in build *201211300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6d636962d3c0
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #222774 - Formatting PHP code causes code to be commented out and may or may not still compile
Comment 8 Martin Kanak 2012-12-06 09:31:45 UTC
verified

Product Version: NetBeans IDE Dev (Build 201212060001)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b17
System: Linux version 3.2.0-33-generic running on amd64; UTF-8; en_US (nb)