Note that there are some explanatory texts on larger screens.

plurals
  1. POUndefined variable: $_SESSION
    text
    copied!<p>I'm getting <code>E_NOTICE</code> errors in a core CakePHP file when it tries to reference a never-set or unset session (<code>cake/libs/cake_session.php line 372</code>):</p> <pre><code>function read($name = null) { if (is_null($name)) { return $this-&gt;__returnSessionVars(); } if (empty($name)) { return false; } $result = Set::classicExtract($_SESSION, $name); } </code></pre> <p>I've done a search through my code (in the app/ directory) and I can't find references to <code>$_SESSION</code> or <code>session_destroy</code>. Am I missing anything?</p> <p>This error shows up when I try to run any unit tests. Is this...normal? I've cleared out the <code>cake/</code> directory and replaced it with another one (same version) just to make sure that I hadn't inadvertently modified anything in the core files, but I still get the same error. I'm not sure if this is just a flaw in the framework or something else.</p> <p><strong>EDIT</strong></p> <p>Here are the results of the test run on the command line:</p> <pre><code>Welcome to CakePHP v1.3.11 Console --------------------------------------------------------------- App : app Path: /var/www/program/app --------------------------------------------------------------- CakePHP Test Shell --------------------------------------------------------------- Running app case models/owners_equity E_NOTICE: Undefined variable: _SESSION in /var/www/program/cake/libs/cake_session.php on line 372 E_NOTICE: Undefined variable: _SESSION in /var/www/program/cake/libs/cake_session.php on line 372 ERROR-&gt;Unexpected PHP error [Undefined variable: _SESSION] severity [E_NOTICE] in [/var/www/program/cake/libs/cake_session.php line 372] in testGenerateOwnerWithdrawals in BalanceTestCase in /var/www/program/app/tests/cases/models/owners_equity.test.php ERROR-&gt;Unexpected PHP error [Undefined variable: _SESSION] severity [E_NOTICE] in [/var/www/program/cake/libs/cake_session.php line 372] in testGenerateOwnerWithdrawals in BalanceTestCase in /var/www/program/app/tests/cases/models/owners_equity.test.php </code></pre>
 

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