Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think this might be a bit hard for an analyser to give warnings about. The code you've given <em>might</em> work with the help register_globals, for example. Also, it might be defined in some other file that is including this file. For those reasons, PHP files should be analyzed with full context of other files for this to be really reliable, and PHP/server configuration should also be either available or defined to the analyzing mechanism.</p> <p>That said, are you sure phplint doesn't do what you want to?</p> <p>There is an <a href="http://www.icosaedro.it/phplint/phplint-on-line.html" rel="noreferrer">online validator</a> that you can use to test it. Given the input:</p> <pre><code>&lt;?php echo $foo; </code></pre> <p>the result was:</p> <pre><code> echo $foo; \_ HERE ==== 3: ERROR: variable `$foo' has not been assigned END parsing of test-qBlPWw ==== ?: notice: unused package `dummy.php' ==== ?: notice: unused module `standard' Overall test results: 1 errors, 0 warnings. </code></pre> <p>whereas with isset() it didn't find any issues.</p> <p>EDIT: so for this other test case:</p> <pre><code>&lt;?php if ($foo == 'bar') echo $foo; </code></pre> <p>On Linux Mint 8 the response is:</p> <pre><code>$ src/phplint test.php /home/vadmin/phplint/phplint-pure-c-1.0_20110223/test.php:3: ERROR: variable `$foo' has not been assigned /home/vadmin/phplint/phplint-pure-c-1.0_20110223/test.php:3: Warning: comparing (unknown) == (string): cannot check the comparison between unknown types Overall test results: 1 errors, 1 warnings. </code></pre> <p>and with this:</p> <pre><code>&lt;?php $foo = '1'; if ($foo == 1) echo $foo; </code></pre> <p>it is:</p> <pre><code>$ src/phplint test.php /home/vadmin/phplint/phplint-pure-c-1.0_20110223/test.php:6: ERROR: comparing (string) == (int) Overall test results: 1 errors, 0 warnings. </code></pre> <p>so isn't it working like it should, and reporting the problem properly?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload