Skip to content

Use $wpdb->last_error and surface not-found context#27

Merged
alexstandiford merged 2 commits into
mainfrom
fix/wpdb-last-error-surfacing
Apr 16, 2026
Merged

Use $wpdb->last_error and surface not-found context#27
alexstandiford merged 2 commits into
mainfrom
fix/wpdb-last-error-surfacing

Conversation

@alexstandiford
Copy link
Copy Markdown
Contributor

@alexstandiford alexstandiford commented Apr 16, 2026

Summary

  • use wpdb->last_error directly when get_results() returns null
  • enrich missing-record exceptions with the actual query or table identity/update payload context
  • add coverage for the null-result and missing-record update paths

Why

The Siren 2.3.3 obligation investigation exposed two problems in the WordPress query layer: it was reading the wrong wpdb error property, and its record-not-found exceptions did not carry enough context to debug what identity or query had actually failed.

Testing

  • vendor/bin/phpunit tests/Unit/Traits/CanQueryWordPressDatabaseTest.php

@alexstandiford alexstandiford changed the title Use $wpdb->last_error when get_results() returns null Use $wpdb->last_error and surface not-found context Apr 16, 2026
@alexstandiford alexstandiford merged commit bf38396 into main Apr 16, 2026
1 check failed
@alexstandiford alexstandiford deleted the fix/wpdb-last-error-surfacing branch April 16, 2026 04:29
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.

1 participant