Added query validation to \RTEX\Objects\Program\Instructions > ArrayGet
This commit is contained in:
parent
c01ad0d6d9
commit
574e7c51f9
1 changed files with 4 additions and 0 deletions
|
@ -5,8 +5,10 @@
|
||||||
namespace RTEX\Objects\Program\Instructions;
|
namespace RTEX\Objects\Program\Instructions;
|
||||||
|
|
||||||
use RTEX\Abstracts\InstructionType;
|
use RTEX\Abstracts\InstructionType;
|
||||||
|
use RTEX\Abstracts\RegexPatterns;
|
||||||
use RTEX\Classes\InstructionBuilder;
|
use RTEX\Classes\InstructionBuilder;
|
||||||
use RTEX\Classes\Utilities;
|
use RTEX\Classes\Utilities;
|
||||||
|
use RTEX\Classes\Validate;
|
||||||
use RTEX\Engine;
|
use RTEX\Engine;
|
||||||
use RTEX\Exceptions\EvaluationException;
|
use RTEX\Exceptions\EvaluationException;
|
||||||
use RTEX\Exceptions\InstructionException;
|
use RTEX\Exceptions\InstructionException;
|
||||||
|
@ -123,6 +125,8 @@
|
||||||
throw new KeyException(sprintf('Cannot read from non-array value of type %s', Utilities::getType($array)));
|
throw new KeyException(sprintf('Cannot read from non-array value of type %s', Utilities::getType($array)));
|
||||||
if(!is_string($value) && !is_int($value))
|
if(!is_string($value) && !is_int($value))
|
||||||
throw new TypeException(sprintf('Cannot read from array with non-string value %s', Utilities::getType($value)));
|
throw new TypeException(sprintf('Cannot read from array with non-string value %s', Utilities::getType($value)));
|
||||||
|
if(!Validate::validateRegex($value, RegexPatterns::ArrayQuery))
|
||||||
|
throw new KeyException(sprintf('Cannot read from array with invalid query %s', $value));
|
||||||
|
|
||||||
$keys = explode('.', $value);
|
$keys = explode('.', $value);
|
||||||
$result = $array;
|
$result = $array;
|
||||||
|
|
Loading…
Add table
Reference in a new issue