Bug 299603 - NPE while developing PHP C-extensions (PHP with non PHP-project)
Summary: NPE while developing PHP C-extensions (PHP with non PHP-project)
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-14 02:58 EST by Martin Eisengardt CLA
Modified: 2020-05-14 10:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Eisengardt CLA 2010-01-14 02:58:05 EST
I was creating an extension using the ext_skel script. The project was created using cdt (C++ development tools). So the project itself is not a pdt project (maybe thats the problem at all). Opening the automatically created php file of the new extension shows up a null pointer exception every time you type a character. Opening and changing some other files (f.e. exis/example.php) shows up other NPEs.

I was using the latest cvs snapshot of dltk and pdt (updated some minustes before to confirm the bug)

--------SNIP php file content
<?php
$br = (php_sapi_name() == "cli")? "":"<br>";

if(!extension_loaded('bgh_reflection')) {
	dl('bgh_reflection.' . PHP_SHLIB_SUFFIX);
}
$module = 'bgh_reflection';
$functions = get_extension_funcs($module);
echo "Functions available in the test extension:$br\n";
foreach($functions as $func) {
    echo $func."$br\n";
}
echo "$br\n";
if (extension_loaded($module)) {
	$bgh = new bgh\reflection\Test();
	echo $bgh->foo();
} else {
	echo "Module $module is not compiled into PHP";
}
?>
--------SNIP

exception 1:
-------------
java.lang.NullPointerException
at org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting$DeprecatedApply.visit(DeprecatedHighlighting.java:55)
at org.eclipse.php.internal.core.ast.nodes.ClassName.accept0(ClassName.java:66)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.ClassInstanceCreation.childrenAccept(ClassInstanceCreation.java:84)
at org.eclipse.php.internal.core.ast.nodes.ClassInstanceCreation.accept0(ClassInstanceCreation.java:74)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.Assignment.childrenAccept(Assignment.java:130)
at org.eclipse.php.internal.core.ast.nodes.Assignment.accept0(Assignment.java:159)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.ExpressionStatement.childrenAccept(ExpressionStatement.java:73)
at org.eclipse.php.internal.core.ast.nodes.ExpressionStatement.accept0(ExpressionStatement.java:67)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.Block.childrenAccept(Block.java:97)
at org.eclipse.php.internal.core.ast.nodes.Block.accept0(Block.java:90)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.IfStatement.childrenAccept(IfStatement.java:96)
at org.eclipse.php.internal.core.ast.nodes.IfStatement.accept0(IfStatement.java:89)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.core.ast.nodes.Program.childrenAccept(Program.java:191)
at org.eclipse.php.internal.core.ast.nodes.Program.accept0(Program.java:184)
at org.eclipse.php.internal.core.ast.nodes.ASTNode.accept(ASTNode.java:275)
at org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticHighlighting.consumes(AbstractSemanticHighlighting.java:93)

exception 2:
--------------
java.lang.NullPointerException
	at org.eclipse.php.internal.core.codeassist.PHPSelectionEngine.extractClasses(PHPSelectionEngine.java:723)
	at org.eclipse.php.internal.core.codeassist.PHPSelectionEngine.internalASTResolve(PHPSelectionEngine.java:349)
	at org.eclipse.php.internal.core.codeassist.PHPSelectionEngine.select(PHPSelectionEngine.java:103)
	at org.eclipse.dltk.internal.core.Openable.codeSelect(Openable.java:553)
	at org.eclipse.dltk.internal.core.AbstractSourceModule.codeSelect(AbstractSourceModule.java:97)
	at org.eclipse.dltk.internal.core.AbstractSourceModule.codeSelect(AbstractSourceModule.java:88)
	at org.eclipse.dltk.internal.ui.text.hover.AbstractScriptEditorTextHover.getHoverInfo(AbstractScriptEditorTextHover.java:141)
	at org.eclipse.php.internal.ui.editor.hover.BestMatchHover.getHoverInfo(BestMatchHover.java:106)
	at org.eclipse.php.internal.ui.editor.hover.PHPTextHoverProxy.getHoverInfo(PHPTextHoverProxy.java:73)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)
Comment 1 Roy Ganor CLA 2010-04-07 17:20:09 EDT
We can probably reproduce this by opening a php file in a non-php project.

This brings a general question about how should we treat PHP files that are context-less? Maybe to have another IEditorInput, or do some tricks made by JDT?
Comment 2 Zhongwei Zhao CLA 2010-04-08 01:27:43 EDT
I do some small changes,but I can still get NPE for php file in a non-php project.
But I think there will be much less NPE than before:)