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

[9.x] Add is_string check to QueriesRelationships@requalifyWhereTables #42341

Merged
merged 2 commits into from
May 10, 2022
Merged

[9.x] Add is_string check to QueriesRelationships@requalifyWhereTables #42341

merged 2 commits into from
May 10, 2022

Conversation

rodrigopedra
Copy link
Contributor

@rodrigopedra rodrigopedra commented May 10, 2022

Closes #42338

This PR:

  • Adds a is_string() check before a str_starts_with() on QueriesRelationships@requalifyWhereTables
  • Adds a test case which would fail without this patch

Notes:

  • The QueriesRelationships@requalifyWhereTables was added by PR [9.x] Add wherehas soft deleting scopes #42100 which tried to fix table prefixing issues when using self-referencing relations
  • There is no need to check non-string values, as the idea is to prefix values used in whereColumn, or other that could reference related tables
  • The added test case used a new stdClass as enums are not available in PHP 8. As it tests the generated SQL statement, the stdClass instance never acutually gets bound to PDO.

EDIT: added information about added test case. Please read 3rd note about it.

@rodrigopedra
Copy link
Contributor Author

rodrigopedra commented May 10, 2022

ping @driesvints , @taylorotwell

P.S.: I didn't add any tests as this is more like a patch bug-fix. I can try adding any later.

EDIT: added test case

@taylorotwell taylorotwell merged commit 25127ba into laravel:9.x May 10, 2022
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

Successfully merging this pull request may close these issues.

[9.12.0] Enum bug within relationship
2 participants