Welcome Guest, Not a member yet? Register   Sign In
Error report in the Codeigniter 4.0.1 SYSTEMPATH\Database\BaseBuilder.php line 1026
#1

(This post was last modified: 01-18-2021, 02:49 PM by yuma2020.)

Hi people, I want to report a problem that codeigniter 4.0.1 is having, I am currently working with a small consultation so that making it an exit situation to work. As you can see, I have some values that are sent through the query constructor.
You can consult in documentation the following valid line to work with:

[b]$builder->whereIn()[/b]

Code:
$names = ['Frank', 'Todd', 'James'];
$builder->whereIn('username', $names);
// Produces: WHERE username IN ('Frank', 'Todd', 'James')
In my case I want to make a query from it, performing similar actions, in which I carry out the sending of information as follows in text mode:
Code:
$listeeed = [1,129,122,123,124,125,126,127,128,130,120];
 $Aquery->whereIn('id' ,  $listeeed );
The consultation from it is fully satisfactory.
Now we put something to the real world on a general level:

Code:
// print_r($loadDataList);// result [0] => 1 [1] => 129 [2] => 122 [3] => 123 [4] => 124 [5] => 125 [6] => 126 [7] => 127 [8] => 128 [9] => 130 [10] => 120
$josns = json_encode($loadDataList);
// print_r($josns); // this is result from var from here [1,129,122,123,124,125,126,127,128,130,120];
      $listeeed = $josns;
$Aquery->whereIn('id' ,  $listeeed );


En lo siguiente como veran el framework presenta problema de la siguiente indole:
InvalidArgumentException
whereIn() expects $values to be of type array or closure 
Code:
line 1026                 throw new \InvalidArgumentException(sprintf('%s() expects $values to be of type array or closure', debug_backtrace(0, 2)[1]['function']));
I would appreciate it if you would give me information on how to get out of this situation, I find it strange because the sending of information is fine in string mode, I do not see the need to make more spaghetti code in something as primitive as a request for data from a query, unless you have to chat with some for cycle, since I am already waiting for your answers.

Update solve

[Image: 4tv4aw.gif]

I a thousand apologies people, something as cuckold as a null response because as the call was made from a function this was not sent, it is possible to clarify the bizarre situation:
Code:
function getA($josns = "")
{
...
}
print_r(getA( ));//here is this problem, :)
this raises the problem, I apologize, but I hope you have left it for our friends in case a similar situation arises.

Is very stupid a solution here:
Code:
print_r(getA($listeeed));
Reply
#2

First off you should upgrade to the CodeIgniter 4.0.4

Also you can always get the bug fixed versions from GitHub develop.

CodeIgniter 4 Development
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB