Undefined variable: _SESSION [CORE/src/Network/Session.php CakePHP 3.0 -
i using cakephp 3.0, , uploaded server, working fine in local somehow after uploading server shows error
notice (8): undefined variable: _session [core/src/network/session.php, line 438]
if have idea please me. still trying solve it.
have tried put session_start();
in appcontroller
, many other places goes blank.
i have found issue, when uploading files servers automatically appending white blank lines @ end of appcontroller , controller files.
so when removed blank lines files working fine again
//to detect file have issue or space or header start //file location : vendor/cakephp/cakephp/src/network/session.php public function write($name, $value = null) { if (empty($name)) { return; } if (!$this->started()) { $this->start(); } $write = $name; if (!is_array($name)) { $write = [$name => $value]; } //remove comment bottom line , run code //show exact file have remove blank space //session_start(); $data = $_session ?: []; foreach ($write $key => $val) { $data = hash::insert($data, $key, $val); } $this->_overwrite($_session, $data); }
small issue took long time detect it,hope all.
Comments
Post a Comment