Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stripos() expects parameter 1 to be string, array given #111

Open
LionTouch opened this issue Jan 21, 2021 · 9 comments
Open

stripos() expects parameter 1 to be string, array given #111

LionTouch opened this issue Jan 21, 2021 · 9 comments

Comments

@LionTouch
Copy link

LionTouch commented Jan 21, 2021

Hi, when i try to execute this code i got this error
stripos() expects parameter 1 to be string, array given
i use laravel 5.8 and compoships ^2.0
i do not know how and why this last is showing
error description

exception: "ErrorException" file: "/var/www/html/intemporel/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php" line: 1047 message: "stripos() expects parameter 1 to be string, array given"

  1. my first model

`
use \Awobaz\Compoships\Compoships;

public function last_message(){
    return $this->hasMany(MessageriesModuleModel::class, ['ID_RECEIVER', 'ID_SENDER'],['ID_USER', 'ID_USER']);
}

`

  1. my second model

`
use \Awobaz\Compoships\Compoships;

public function user()
{
    return $this->belongsTo(UsersModuleModel::class, ['ID_USER','ID_USER'],[ 'ID_RECEIVER','ID_SENDER']);
}

`

@tspesh
Copy link

tspesh commented Feb 14, 2021

Seeing this on Lumen 8.x as well

@topclaudy
Copy link
Owner

That's weird! Can you provide a simple Laravel project to reproduce this?

@mShbieb
Copy link

mShbieb commented Mar 3, 2021

@topclaudy
Did you solve it?

@matalina
Copy link

matalina commented Apr 5, 2021

I am seeing this as well... specifically when eager loading multi level relationships .ie:

Inventory::with('models.brands')->get();

I can fetch the $inventory->models[0]->brand without the eager loading so it's working.

I am using laravel 8 on php 8. The same code is working in the latest laravel 7 on php 7.2

@topclaudy
Copy link
Owner

Please provide a Laravel project to reproduce your issues

@matalina
Copy link

matalina commented Apr 6, 2021

Please provide a Laravel project to reproduce your issues

I'm attempting to create a simple app that reflects this issue. However its not doing it with an sqlite database.

My repo I'm seeing the error in is an MSSQL database. So that might be the underlying difference, but I cant easily test the MSSQL database as I don't have one locally installed and production is not write accessible.

I have narrowed it down to hasMany relationship. But still unable to reproduce it on an sqlite install -- still only happening on MSSQL. It happens on a single level eager loading hasMany relationship.

@fabriciozeferino
Copy link

fabriciozeferino commented Jun 4, 2021

Hi guys, I get the same with this relation:

public function subscription(): HasOne
    {
        return $this->hasOne(Subscription::class, 'member_id');
    }

    public function subscriptionsAdmin(): HasMany
    {
        return $this->hasMany(Subscription::class, 'admin_id');
    }

    public function subscriptions()
    {
        return $this->hasMany(Subscription::class, ['member_id', 'admin_id'], ['id', 'id']);
    }

Anyone sport what I'm missing here?

Thanks

@ib-ganz
Copy link

ib-ganz commented Jan 19, 2022

i get this error too. i'm using laravel 8.53.0

@BaloccoDev
Copy link

BaloccoDev commented Jul 13, 2022

Same problem here laravel 8.83, using chunk instead of get, it happens when using multiple primary keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants