Jump to content


Photo

Netbeans "variable seems to be uninitialized"


  • Please log in to reply
4 replies to this topic

#1 The Little Guy

The Little Guy

    Advanced Member

  • Members
  • PipPipPip
  • 6,676 posts

Posted 30 June 2012 - 02:58 PM

In my Netbeans editor, I get this warning, when using a variable that is defined in an included file:
Variable $name seems to be uninitialized

Anyone know how to make Netbeans see that it is in fact initiated in the file that is being included?

config.php
<?php
$temp = new Template();

index.php
<?php
/** 
 * @var $temp Template
 */
require_once "config.php";
$temp->display("index.tpl");

In my above example, in index.php $temp says Variable $temp seems to be uninitialized and yet it is but in the included file. adding the @var turns on auto complete, in the file for $temp, but the variable still shows it is uninitialized.

So, Anyone know how to turn it on in Netbeans?
phpLive - A powerful library that implements many common tasks to make php programming faster. Supports extensions and plugins. Current version: 1.0.0-Alpha
Twitter: http://twitter.com/phpsnips
http://dreamhost.com (promo code: 8RN4)
$30 off 1 year of hosting
$40 off 2 years of hosting

#2 Philip

Philip

    Phailip

  • Staff Alumni
  • 4,742 posts

Posted 30 June 2012 - 03:03 PM

I haven't seen an option for that, just to turn it off/on and what it should show as (warning, error, etc.). Would be nice, but I don't think there is one?

#3 The Little Guy

The Little Guy

    Advanced Member

  • Members
  • PipPipPip
  • 6,676 posts

Posted 30 June 2012 - 03:24 PM

Its weird, because when I type type it, Auto Complete even knows what file it is initiated in, but the editor doesn't...
phpLive - A powerful library that implements many common tasks to make php programming faster. Supports extensions and plugins. Current version: 1.0.0-Alpha
Twitter: http://twitter.com/phpsnips
http://dreamhost.com (promo code: 8RN4)
$30 off 1 year of hosting
$40 off 2 years of hosting

#4 xyph

xyph

    Advanced Member

  • Staff Alumni
  • 3,712 posts
  • LocationSurrey, BC

Posted 30 June 2012 - 07:56 PM

That's really odd. I've never see that. Both files are in the same project?


Everything you need to know about storing user-names and passwords
http://www.openwall....Users-Passwords
Blank Page? Try forcing errors to display
ini_set('display_errors',1);
error_reporting(-1);

#5 The Little Guy

The Little Guy

    Advanced Member

  • Members
  • PipPipPip
  • 6,676 posts

Posted 01 July 2012 - 01:39 AM

That's really odd. I've never see that. Both files are in the same project?


Yeah, they are both in the same project, but different locations, not sure if that matters:

/index.php
/includes/setup.php
phpLive - A powerful library that implements many common tasks to make php programming faster. Supports extensions and plugins. Current version: 1.0.0-Alpha
Twitter: http://twitter.com/phpsnips
http://dreamhost.com (promo code: 8RN4)
$30 off 1 year of hosting
$40 off 2 years of hosting




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com