franzose / kontrolio Goto Github PK
View Code? Open in Web Editor NEWSimple standalone data validation library inspired by Laravel and Symfony
License: MIT License
Simple standalone data validation library inspired by Laravel and Symfony
License: MIT License
Uncaught exception PHPException: PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 179 in /***/vendor/franzose/kontrolio/src/Rules/Core/Url.php on line 74
Backtrace:
1. preg_match('~^
(http|https):// # protocol
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
(
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
| # or
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
| # or
\[
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))
\] # a IPv6 address
)
(:[0-9]+)? # a port (optional)
(/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment
$~ixu', 'www.somedomain.ru') in Url.php, line 74
2. Kontrolio\Rules\Core\Url->isValid('www.somedomain.ru') in Validator.php, line 439
3. Kontrolio\Validator->handle(object Kontrolio\Rules\Core\Url, 'homepage', 'www.somedomain.ru') in Validator.php, line 408
4. Kontrolio\Validator->validate() in ProfileController.php, line 427
'orgPostAddress' => [
(new Core\Length(2,25))->allowEmptyValue()
]
passes not only empty value. This rule passes ANY value
хорошо бы вот тут коммент #[\ReturnTypeWillChange] добавить
kontrolio/src/Error/Errors.php
Line 57 in 21a355f
Please include php version compatibility in readme.
Thanks
Thank you for the great package (I'm so surprised it has so little downloads count).
It would be great to provide a little future.
I want to leave messages array empty and receive the output like:
[
'email' => [
'email.email',
'email.not_blank'
]
]
Then I'll pass this array to my translator, instead of creating array by hands every time.
['foo' => [new UntilFirstFailure, new Bar(), new Baz()],]
Не смотря на то, что Bar::isValid()
возвращает false - Baz::isValid()
все равно вызывается.
спасибо за валидатор. сам хотел нечто подобное соорудить но вы первее )
допустим такой код
$validator = Validator::getInstance()->make($request->getParsedBody(), [
'type' => 'between:1,5',
'value' => [
function($value) {
return is_numeric($value);
},
new LessThanOrEqual(20),
],
]);
if (!$validator->validate()) {
dd($validator->getErrorsList());
}
отдаёт
array:1 [
0 => "value.less_than_or_equal"
]
хотелось бы вариант вывода - есть в поле ошибка или нет
т.е. key тот-же что и во входных данных а значение boolean
успешно или не успешно валидировано поле
это возможно?
вообще универсальности ради было бы неплохо дать возможность сделать свой форматтер
который возвращает ошибки в том виде как нужно в конкретной ситуации.
ну прицепить стандартный вариант форматтера, как наглядное пособие.
спасибо!
$data = [];
or
$data = [
'attribute' => ''
];
or
$data = [
'attribute' => 'abcd'
];
always invalid with:
$rules = [
'attribute' => [
new Sometimes,
new Length(5, 15)
]
];
this code does nothing
if ($this->bypass) {
continue;
}
he passes only Sometimes rule, and always execute isValid of Length
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.