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 236712 - Add PHP 5.5 finally keyword support
Summary: Add PHP 5.5 finally keyword support
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-03 17:30 UTC by Fleshgrinder
Modified: 2013-10-17 14:11 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fleshgrinder 2013-10-03 17:30:09 UTC
This is a major issue, because if one uses the finally keyword anywhere in the code the complete file is marked as invalid and code completion isn't working in the file itself nor in any files that extend that file.

https://wiki.php.net/rfc/finally
Comment 1 Ondrej Brejla 2013-10-03 17:45:04 UTC

*** This bug has been marked as a duplicate of bug 230677 ***
Comment 2 Fleshgrinder 2013-10-04 07:14:58 UTC
Sorry, have to reopen this one because it's not entirely working as it should.

https://wiki.php.net/rfc/finally

<?php
$db = mysqli_connect();
try {
   call_some_function($db);//the function may throw exceptions which we can not handle
} finally {
   mysqli_close($db);
}

The above code is valid but marked as invalid in NetBeans (trunk).

I wasn't able to test the following:

<?php
  try {
    return 2;
  } finally {
    echo "this will be called\n";
  }
  //this will never be called
  echo "you can not see me";

As it's directly marked as error by NetBeans (trunk), but it might be marked as "unreachable code" because of the return, that's something that shouldn't happen (if it happens).

Kindest regards
Comment 3 Ondrej Brejla 2013-10-04 10:00:46 UTC
You have to open project properties and switch to use PHP 5.5 version. And don't change meta info, thanks. 

If you see some issue (the second use case), file a new one. But not sure what you try to tell me, that unreachable statement hint doesn't work with a finally kw? Yep, it's possible. But as I said, it's another issue. Thanks.
Comment 4 Fleshgrinder 2013-10-04 10:03:09 UTC
I changed the project to PHP 5.5, still the following is marked as error:

try {}
finally {}

This isn't:

try {}
catch {}
finally {}

Shall I open another issue for this as well?
Comment 5 Ondrej Brejla 2013-10-04 10:11:10 UTC
Yes, P3 defect, thanks.
Comment 6 Ondrej Brejla 2013-10-08 09:01:01 UTC
Fixed in issue #236865.
Comment 7 mmolda 2013-10-17 14:11:48 UTC
Verified. Thanks.

Product Version: NetBeans IDE Dev (Build 201310170001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)