mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Catch php error in ruler evaluate. Unify all dates functions by using real DateTime objects and function date -> date_create and date_from_format -> date_create_from_format.
This commit is contained in:
parent
6bd18c95cc
commit
3f632e9db7
2 changed files with 13 additions and 16 deletions
|
@ -43,18 +43,15 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
|||
{
|
||||
try
|
||||
{
|
||||
$this->expression_language->parse($condition, array_keys($data));
|
||||
//Use @ to hide notices on non defined vars
|
||||
@$this->expression_language->parse($condition, array_keys($data));
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
catch (\Throwable $t) //Catch both, exceptions and php error
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (\Throwable $t)
|
||||
{
|
||||
//Just ignore non critical php warning and notice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,11 +66,12 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
|||
{
|
||||
try
|
||||
{
|
||||
//Use @ to hide notices on non defined vars
|
||||
@$result = $this->expression_language->evaluate($condition, $data);
|
||||
|
||||
return (bool) $result;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
catch (\Throwable $t) //Catch both, exceptions and php error
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue