db
db copied to clipboard
Nested "orWhere" WhereClauses broken when using CRUD
Running something like this should reproduce it:
DB::table( 'posts' )
->where( 'post_author', 10 )
->where( static function( WhereQueryBuilder $builder ) {
$builder->where( 'post_status', 'published' )
->orWhere( 'post_name', 'hello-world' );
} )->update( [
'post_except' => 'Testing 123',
] );
There are two cases of WhereClauses that create strings, instead of a Where instance:
Then, when CRUD::getWhere() runs, it expects these to be Where instances, so the library throws notices here as it's not an object, but crashes in tests where notices throw exceptions (as it should, pointing out this bug).