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 240274 - or die formatting
Summary: or die formatting
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-11 13:24 UTC by nbsocko
Modified: 2014-01-30 17:15 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NB 7.4 options export (2.39 MB, application/zip)
2014-01-13 21:19 UTC, nbsocko
Details
formatting options screenshot (109.22 KB, image/png)
2014-01-13 21:21 UTC, nbsocko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nbsocko 2014-01-11 13:24:00 UTC
Formatting a document with the following PHP code:

copy($old,$new) or die("(proj) unable to copy $old to $new.");

… removes the spaces around the keyword 'or', resulting in:

copy($old,$new)ordie("(proj) unable to copy $old to $new.");
Comment 1 mmolda 2014-01-13 16:10:43 UTC
Sorry it is working for me correctly. What version of NetBeans are you using? (copy info from Help->About).

Can you please try it in the latest dev version[1]? If it is not working, simply reopen this issue.

Thanks.

[1] http://bits.netbeans.org/dev/nightly/

Product Version: NetBeans IDE Dev (Build 201401100002)
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 2 nbsocko 2014-01-13 21:19:59 UTC
Created attachment 143925 [details]
NB 7.4 options export
Comment 3 nbsocko 2014-01-13 21:21:47 UTC
Created attachment 143926 [details]
formatting options screenshot
Comment 4 nbsocko 2014-01-13 21:24:09 UTC
Still happening for me in the latest dev version you linked.  Entire file contents:

<?php
copy($old,$new) or die("error");
?>

After choosing menu option Source > Format:

<?php
copy($old,$new)ordie("error");
?>

Screenshot attached as well as an export of all of my options.
Comment 5 nbsocko 2014-01-13 21:48:15 UTC
I've narrowed the issue down to Options > Editor > Formatting > PHP > Spaces > Around Operators > Binary Operators.  Evidently NB is treating the word version of operator in:

function() or die();

… like the non-word '||' comparison operator.  Removing spacing around the non-word operator is fine, but removing spacing around the word operator causes a coding error.

The following statements also exhibit the same issue:

// before formatting: 
copy($old,$new) xor die("error");
copy($old,$new) and die("error");

// after formatting:
copy($old,$new)xordie("error");
copy($old,$new)anddie("error");
Comment 6 mmolda 2014-01-14 12:53:44 UTC
Now I got it! Thanks for exact steps.

Reproducible.

Product Version: NetBeans IDE Dev (Build 201401130002)
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 7 Ondrej Brejla 2014-01-14 13:23:57 UTC
Fixed in web-main #7a78054d14f5
Comment 8 nbsocko 2014-01-14 13:51:18 UTC
Wow, that was fast!  Thanks for the fix guys  :)
Comment 9 mmolda 2014-01-30 17:15:40 UTC
Verified. Thanks

Product Version: NetBeans IDE Dev (Build 201401300001)
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b67
Runtime: Java(TM) SE Runtime Environment 1.8.0-b126
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)