Skip to content

Commit dc26178

Browse files
committed
fixed some issue about array index
1 parent 1bd7cbb commit dc26178

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22

3-
$rootDir = str_replace('\\', '/', dirname(__DIR__, 1)) . DIRECTORY_SEPARATOR;
4-
5-
require $rootDir . 'vendor/autoload.php';
3+
require '../vendor/autoload.php';
64

75
use Nahid\JsonQ\Jsonq;
86

src/JsonQueriable.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ protected function processConditions()
271271
foreach ($cond as $rule) {
272272
$func = 'cond' . ucfirst($this->_rulesMap[$rule['condition']]);
273273
if (method_exists($this, $func)) {
274-
$return = call_user_func_array([$this, $func], [$val[$rule['key']], $rule['value']]);
274+
if (isset($val[$rule['key']])) {
275+
$return = call_user_func_array([$this, $func], [$val[$rule['key']], $rule['value']]);
276+
}else {
277+
$return = false;
278+
}
275279
$tmp &= $return;
276280
} else {
277281
throw new ConditionNotAllowedException('Exception: ' . $func . ' condition not allowed');

0 commit comments

Comments
 (0)