[TASK] Improve validation of empty strings
This commit is contained in:
parent
3e37d9882c
commit
fbd07a1545
@ -244,8 +244,14 @@ class ActionController extends BaseController
|
|||||||
protected function validateInput($input, $schema)
|
protected function validateInput($input, $schema)
|
||||||
{
|
{
|
||||||
$validator = new Validator();
|
$validator = new Validator();
|
||||||
|
$input = array_filter($input, function($element) {
|
||||||
|
if (is_string($element) && !strlen($element)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $element;
|
||||||
|
});
|
||||||
$validationResult = $validator->dataValidation(
|
$validationResult = $validator->dataValidation(
|
||||||
$input,
|
(object)$input,
|
||||||
json_encode($schema),
|
json_encode($schema),
|
||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
@ -299,6 +305,21 @@ class ActionController extends BaseController
|
|||||||
return $validationResult->isValid();
|
return $validationResult->isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns plugin namespace to build js post request
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function getPluginNamespace()
|
||||||
|
{
|
||||||
|
$extensionName = $this->request->getControllerExtensionName();
|
||||||
|
$pluginName = $this->request->getPluginName();
|
||||||
|
return $this->extensionService->getPluginNamespace(
|
||||||
|
$extensionName,
|
||||||
|
$pluginName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets vars which are needed by the ajax requests
|
* sets vars which are needed by the ajax requests
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user