Skip to content

Nested "orWhere" WhereClauses broken when using CRUD #23

@defunctl

Description

@defunctl

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:

  1. one
  2. two

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).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions