Skip to content

Conversation

@neznaika0
Copy link
Contributor

Description
Comment #9830 (comment)

For the event, I returned the transfer of an array IDs or null.

An attempt to return the check for incorrect PK update()/delete(). Values of '' 0 '0' null and the same values in the array [1 => null, 2 => '', 3 => '0',...] are invalid, they can cause SQL exception. We intercept this before executing the query and throw our DatabaseException.

In this state, it only solves for the $id passed to delete(), update(). But we can pass the value via where('id', [1, 2, 3])-> update() or whereIn('id', [1, 2, 3])-> update() and other. Therefore, I need to know whether to handle these cases or return an SQL exception to the user?

Example bad SQL:

# where('id', [])
#  SQLite3Exception: near ")": syntax error
UPDATE `db_user` SET `deleted_at` = '2025-12-12 09:57:36'
WHERE `id` = ()
AND `deleted_at` IS NULL

# where('id', [15 => 150, '_id_' => '200', 20 => '0'])
# DatabaseException: row value misused
UPDATE `db_user` SET `deleted_at` = '2025-12-12 09:57:36'
WHERE `id` = (150,'200','0')
AND `deleted_at` IS NULL

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@neznaika0 neznaika0 force-pushed the fix/pk-model-checker branch from d348aef to cd6ebfc Compare December 12, 2025 10:26
@neznaika0
Copy link
Contributor Author

@michalsn We can discuss with an example. PR is not virtual.

@michalsn
Copy link
Member

Good direction. Yesterday evening, I started putting together a version of how I'd like it to work/look. I'll try to send a PR on Sunday, as I'll be AFK today.

@github-actions github-actions bot added the stale Pull requests with conflicts label Dec 14, 2025
@github-actions
Copy link

👋 Hi, @neznaika0!

We detected conflicts in your PR against the base branch 🙊
You may want to sync 🔄 your branch with upstream!

Ref: Syncing Your Branch

@neznaika0 neznaika0 closed this Dec 14, 2025
@neznaika0 neznaika0 deleted the fix/pk-model-checker branch December 14, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Pull requests with conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants