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', '-')); }