API 8 filter dropping the "e" and "q" characters

I am trying to use the filter in the V8 API as follows:

/api/v8/modules/Accounts?filter[Accounts.name]=[[eq]]abcdefghijklmnopqrstuvwxyz

I am logging all the SQL in mysql after setting: SET GLOBAL general_log = ‘ON’;

The SQL I am seeing is:

SELECT count(*) c FROM accounts  LEFT JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c   LEFT JOIN  users jt0 ON accounts.modified_user_id=jt0.id AND jt0.deleted=0
 AND jt0.deleted=0  LEFT JOIN  users jt1 ON accounts.created_by=jt1.id AND jt1.deleted=0
 AND jt1.deleted=0  LEFT JOIN  users jt2 ON accounts.assigned_user_id=jt2.id AND jt2.deleted=0
 AND jt2.deleted=0  LEFT JOIN  accounts jt3 ON accounts.parent_id=jt3.id AND jt3.deleted=0
 AND jt3.deleted=0  LEFT JOIN  campaigns jt4 ON accounts.campaign_id=jt4.id AND jt4.deleted=0
 AND jt4.deleted=0 where (accounts.name = "abcdfghijklmnoprstuvwxyz") AND accounts.deleted=0

You can see clearly that the e and q are dropped out meaning I cannot use this filter.
Am I missing something?

The API seems to be removing the characters which is in the operator.
So for [[eq]] it drops the e and q and for [[li]] it is dropping the l and the i.

It is quite a showstopper for this API, is no one else having this issue or even using the V8 API?

I found the solution:

The operator is indeed removed from the operand as I suspected, the “operator array” should only be diff’ed once from the operand as follows:

/lib/API/JsonApi/v1/Filters/Parsers/FilterParser.php

Add the function (not my code, found it on php.net) :


private function array_diff_once(){
        if(($args = func_num_args()) < 2)
            return false;
        $arr1 = func_get_arg(0);
        $arr2 = func_get_arg(1);
        if(!is_array($arr1) || !is_array($arr2))
            return false;
        foreach($arr2 as $remove){
            foreach($arr1 as $k=>$v){
                if((string)$v === (string)$remove){ //NOTE: if you need the diff to be STRICT, remove both the '(string)'s
                    unset($arr1[$k]);
                    break; //That's pretty much the only difference from the real array_diff :P
                }
            }
        }
        //Handle more than 2 arguments
        $c = $args;
        while($c > 2){
            $c--;
            $arr1 = array_diff_once($arr1, func_get_arg($args-$c+1));
        }
        return $arr1;
    }

And change this function as follows:


private function stringDifference($a, $b) {
        $aArray = str_split($a);
        $bArray = str_split($b);
        //$arrayDiff = array_diff($aArray, $bArray);
        $arrayDiff = $this->array_diff_once($aArray, $bArray);
        return implode('', $arrayDiff);
    }

Obviously this needs to be fixed properly and not hacked in like I did but I do not have the knowledge on how to do this now properly. Any input would be appreciated.