undefined variable PHP
I am seeing an issue where variables defined in one php file are getting tagged as undefined when used from another file that includes it (via require)
For example:
Suppose we have the project structure like this:
project/
|-- config
| `-- config.inc.php
|-- index.php
|-- test
| `-- test.php
and config.inc.php just defines some variables:
<?php
$someConfigVariable = 3600;
$configFoo = "config";
$configBar = "bar";
$configBlah = "blah";
?>
and test.php includes config.inc.php and uses the variables define therein
<?php
require "../config/config.inc.php";
if ($someConfigVariable > 0) {
echo $configFoo;
} else {
echo $configBar;
}
echo $configBlah;
?>
Now PhpStorm complains that the variables (e.g. $someConfigVariable) are Undefined.
So what am I doing wrong? Is there some project setting I need to set some where (include path perhaps?)? The project was created from existing sources. The content root is correct, and I can ctrl-click to navigate to config.inc.php.
thanks,
-raleigh
请先登录再写评论。
Hi Raleigh,
Nothing.
Nope.
PhpStorm does not handle such variables properly ATM (I'm referring to latest v4 EAP build) -- http://youtrack.jetbrains.com/issue/WI-10416
I see, many thanks. Hopefully this will be fixed for v4 release.