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 251578 - Wrong uninitialized prompt
Summary: Wrong uninitialized prompt
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
Depends on:
Reported: 2015-04-02 02:27 UTC by fcjailybo
Modified: 2016-06-07 15:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

the prompt screeshot (11.14 KB, image/png)
2015-04-02 02:27 UTC, fcjailybo

Note You need to log in before you can comment on or make changes to this bug.
Description fcjailybo 2015-04-02 02:27:39 UTC
Created attachment 152991 [details]
the prompt screeshot

I use try {} catch{},code like follow:
public function test() {
        try {
            $sk = 'knight';
        } catch (Exception $exc) {
            echo $exc->getMessage() . '<br>';
            echo $sk;

I define $sk at try {}, and use it at catch{}, but the IDE prompt me that $sk seems to be uninitialized.
Comment 1 Tomas Mysik 2016-06-07 15:10:52 UTC
Well, this seems to be correct because e.g. in Java, this would be an error. You would need to type something like this:

$sk = null;
try {
    $sk = 'knight';
} catch (Exception $exc) {
    echo $exc->getMessage() . '<br>';
    echo $sk;

But this is not necessary in PHP so there should not be any warning here.

Thanks for reporting.