From 28a627acac4433d3bc69dd4f2a7d8339fda4e809 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 1 Mar 2016 20:37:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E5=A4=A7=E5=B0=8F=E5=86=99=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 8 ++++---- tests/thinkphp/library/think/routeTest.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 51dcede1..c09f7746 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -260,7 +260,7 @@ class Model // 检查非数据字段 if (!empty($fields)) { foreach ($data as $key => $val) { - if (!in_array(strtolower($key), $fields, true)) { + if (!in_array($key, $fields, true)) { if (Config::get('db_fields_strict')) { throw new Exception(' fields not exists :[ ' . $key . ' ]'); } @@ -1248,7 +1248,7 @@ class Model // 行为验证 $result = Hook::exec($rule, '', $data); break; - case 'filter': // 使用filter_var验证 + case 'filter': // 使用filter_var验证 $result = filter_var($value, is_int($rule) ? $rule : filter_id($rule), $options); break; case 'confirm': @@ -1259,8 +1259,8 @@ class Model $range = is_array($rule) ? $rule : explode(',', $rule); $result = 'in' == $type ? in_array($value, $range) : !in_array($value, $range); break; - case 'between':// 验证是否在某个范围 - case 'notbetween': // 验证是否不在某个范围 + case 'between': // 验证是否在某个范围 + case 'notbetween': // 验证是否不在某个范围 if (is_string($rule)) { $rule = explode(',', $rule); } diff --git a/tests/thinkphp/library/think/routeTest.php b/tests/thinkphp/library/think/routeTest.php index 6acb9b36..6aaf2ec2 100644 --- a/tests/thinkphp/library/think/routeTest.php +++ b/tests/thinkphp/library/think/routeTest.php @@ -73,7 +73,9 @@ class routeTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(['type' => 'module', 'module' => ['hello', null, null]], Route::parseUrl('hello')); $this->assertEquals(['type' => 'module', 'module' => ['index', 'hello', null]], Route::parseUrl('index/hello')); + $this->assertEquals(['type' => 'module', 'module' => ['index', 'hello', null]], Route::parseUrl('index/hello?name=thinkphp')); $this->assertEquals(['type' => 'module', 'module' => ['index', 'user', 'hello']], Route::parseUrl('index/user/hello')); + $this->assertEquals(['type' => 'module', 'module' => ['index', 'user', 'hello']], Route::parseUrl('index/user/hello/name/thinkphp')); $this->assertEquals(['type' => 'module', 'module' => ['index', 'index', 'hello']], Route::parseUrl('index-index-hello', '-')); }