From 451e7f0dda257c924e6fad6585655927c838aabf Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 7 Jun 2016 17:05:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BInput=E7=B1=BB=E5=92=8CReques?= =?UTF-8?q?t=E7=B1=BB=E7=9A=84session=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Input.php | 6 ++---- library/think/Request.php | 6 ++---- tests/thinkphp/library/think/loaderTest.php | 2 -- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/library/think/Input.php b/library/think/Input.php index 96b7e90e..15e8f880 100644 --- a/library/think/Input.php +++ b/library/think/Input.php @@ -13,6 +13,7 @@ namespace think; use think\Config; use think\File; +use think\Session; class Input { @@ -129,10 +130,7 @@ class Input */ public static function session($name = '', $default = null, $filter = null, $merge = false) { - if (PHP_SESSION_DISABLED == session_status()) { - session_start(); - } - return self::data($_SESSION, $name, $default, $filter, $merge); + return self::data(Session::get(), $name, $default, $filter, $merge); } /** diff --git a/library/think/Request.php b/library/think/Request.php index a87e7848..f079fcbd 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -13,6 +13,7 @@ namespace think; use think\Config; use think\Input; +use think\Session; class Request { @@ -632,10 +633,7 @@ class Request */ public function session($name = '') { - if (PHP_SESSION_DISABLED == session_status()) { - session_start(); - } - return Input::data($this->session ?: $_SESSION, $name); + return Input::data($this->session ?: Session::get(), $name); } /** diff --git a/tests/thinkphp/library/think/loaderTest.php b/tests/thinkphp/library/think/loaderTest.php index 0f1a1a2c..60d1b441 100644 --- a/tests/thinkphp/library/think/loaderTest.php +++ b/tests/thinkphp/library/think/loaderTest.php @@ -23,8 +23,6 @@ class loaderTest extends \PHPUnit_Framework_TestCase public function testAutoload() { - $this->assertEquals(true, Loader::autoload('think\Session')); - //$this->assertEquals(false, Loader::autoload('think\COOKIE')); $this->assertEquals(false, Loader::autoload('\think\Url')); $this->assertEquals(false, Loader::autoload('think\Test')); $this->assertEquals(false, Loader::autoload('my\HelloTest'));