diff --git a/system/engine/restful.php b/system/engine/restful.php index b135f62..673b804 100644 --- a/system/engine/restful.php +++ b/system/engine/restful.php @@ -115,13 +115,13 @@ class RESTful extends Controller { if(is_array($type)){ foreach ($type as $avalType) { - if(call_user_func("is_" . $avalType, $data)) { + if(self::__testType( $avalType, $data)) { $invalidDataType = false; break; } } } else { - if(call_user_func("is_" . $type, $data)) { + if(self::__testType($type, $data)) { $invalidDataType = false; } } @@ -161,6 +161,35 @@ class RESTful extends Controller { } } + static function __testType($type, $data){ + + switch ($type) { + case 'mixed': + return true; + break; + + case 'int': + case 'string': + case 'array': + case 'integer': + case 'bool': + case 'double': + case 'float': + case 'long': + case 'null': + case 'numeric': + case 'scalar': + case 'real': + return call_user_func("is_" . $type, $data); + break; + + default: + return false; + break; + } + + } + /** * Not found default method *