Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318124

Summary: "Unhandled event loop exception" when trying to generate class method element comment when return statement is 'return isset(...'
Product: z_Archived Reporter: IanD <solutions>
Component: PDTAssignee: PHP UI <php.ui-inbox>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P1 CC: gadi, ganoro, solutions, zhaozhongwei
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description IanD CLA 2010-06-27 08:57:52 EDT
Build Identifier: 20100218-1602

When the return statement of a class method has the function 'isset' as its outermost layer, 'generate element comment' throws the exception.

Presumably there's something missing that prevents eclipse from determining the return type of the function 'isset' - see workaround below

Bottom of exception stack is 
java.lang.NullPointerException
	at org.eclipse.php.ui.CodeGeneration.getMethodComment(CodeGeneration.java:385)


Reproducible: Always

Steps to Reproduce:
Try to "generate element comment" for method 'doSomething' in the following examples:

1.

class A {
public function doSomething() {
$a=1;
return isset($a);
}
}
2.

class A {
public function doSomething() {
$a=1;
return (bool) isset($a);
}
}
3.

class A {
public function doSomething() {
$a=1;
return is_int($a);
}
}

Expected results:
- all examples generate an element comment

Actual results:
- Examples 2 & 3 generate the comment
- Example 1 fails with the exception described

Workaround:
- prefix the 'isset' with '(bool)' or '!!' and generate the comment.
Comment 1 Zhongwei Zhao CLA 2010-06-27 09:22:49 EDT
Could not reproduce this bug using latest code.
Comment 2 Gadi Goldbarg CLA 2010-08-19 11:19:50 EDT
Verified fixed.
Kalin Yanev
kalin.a@zend.com