Skip to content

Commit

Permalink
fixed some issue about array index
Browse files Browse the repository at this point in the history
  • Loading branch information
nahid committed May 15, 2018
1 parent 1bd7cbb commit dc26178
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions examples/index.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

$rootDir = str_replace('\\', '/', dirname(__DIR__, 1)) . DIRECTORY_SEPARATOR;

require $rootDir . 'vendor/autoload.php';
require '../vendor/autoload.php';

use Nahid\JsonQ\Jsonq;

Expand Down
6 changes: 5 additions & 1 deletion src/JsonQueriable.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ protected function processConditions()
foreach ($cond as $rule) {
$func = 'cond' . ucfirst($this->_rulesMap[$rule['condition']]);
if (method_exists($this, $func)) {
$return = call_user_func_array([$this, $func], [$val[$rule['key']], $rule['value']]);
if (isset($val[$rule['key']])) {
$return = call_user_func_array([$this, $func], [$val[$rule['key']], $rule['value']]);
}else {
$return = false;
}
$tmp &= $return;
} else {
throw new ConditionNotAllowedException('Exception: ' . $func . ' condition not allowed');
Expand Down

0 comments on commit dc26178

Please sign in to comment.