From bc005cd014925ee0bc151994edc736c5c77a93a6 Mon Sep 17 00:00:00 2001 From: "Larry E. Masters" Date: Mon, 28 Dec 2015 23:32:18 -0500 Subject: [PATCH] Fixing Undefined index: Session --- lib/Cake/Model/Datasource/Session/DatabaseSession.php | 4 ++++ .../Case/Model/Datasource/Session/DatabaseSessionTest.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 145b47249..0a8b3c25a 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -92,6 +92,10 @@ class DatabaseSession implements CakeSessionHandlerInterface { 'conditions' => array($this->_model->alias . '.' . $this->_model->primaryKey => $id) )); + if(empty($row[$this->_model->alias])){ + return ''; + } + if (!is_numeric($row[$this->_model->alias]['data']) && empty($row[$this->_model->alias]['data'])) { return ''; } diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php index ca33856c4..fb5b0bfef 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php @@ -147,7 +147,6 @@ class DatabaseSessionTest extends CakeTestCase { $this->storage->write('bar', 0); $this->assertEquals(0, $this->storage->read('bar')); $this->assertSame('', $this->storage->read('made up value')); - } /**