@@ -204,30 +204,30 @@ public function validate(array $onlyChecked = null, $stopOnError = null)
204204 }
205205
206206 $ value = $ this ->getByPath ($ field , $ defValue );
207- // $hasWildcard = (bool)strpos($field, '*');
208207
209- // mark field is safe. not need validate. like. 'created_at'
210- if ($ validator === 'safe ' ) {
211- $ this ->setSafe ($ field , $ value );
212- continue ;
213- }
214-
215- // required* 系列字段检查器 || 文件资源检查
216- if (\is_string ($ validator ) && (self ::isCheckRequired ($ validator ) || self ::isCheckFile ($ validator ))) {
217- if (!$ this ->fieldValidate ($ field , $ value , $ validator , $ args , $ defMsg ) && $ this ->isStopOnError ()) {
218- break ;
208+ if (\is_string ($ validator )) {
209+ if ($ validator === 'safe ' ) {
210+ $ this ->setSafe ($ field , $ value );
211+ continue ;
219212 }
220213
221- continue ;
214+ // required*系列字段检查 || 文件资源检查
215+ if (self ::isCheckRequired ($ validator ) || self ::isCheckFile ($ validator )) {
216+ if (!$ this ->fieldValidate ($ field , $ value , $ validator , $ args , $ defMsg ) && $ this ->isStopOnError ()) {
217+ break ;
218+ }
219+
220+ continue ;
221+ }
222222 }
223223
224224 // 设定了为空跳过 并且 值为空
225225 if ($ skipOnEmpty && Helper::call ($ isEmpty , $ value )) {
226226 continue ;
227227 }
228228
229- // 字段值过滤
230- if ($ filters ) {
229+ // 字段值过滤(有通配符`*`的字段, 不应用过滤器)
230+ if ($ filters && ! strpos ( $ field , ' .* ' ) ) {
231231 $ value = $ this ->valueFiltering ($ value , $ filters );
232232 $ this ->data [$ field ] = $ value ;
233233 }
0 commit comments