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

Nested "orWhere" WhereClauses broken when using CRUD #23

Open
defunctl opened this issue Nov 18, 2024 · 0 comments
Open

Nested "orWhere" WhereClauses broken when using CRUD #23

defunctl opened this issue Nov 18, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@defunctl
Copy link
Contributor

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

@defunctl defunctl added the bug Something isn't working label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants