Skip to content

[Query monitor] Tolerate null $value in boot.php#219

Merged
adamziel merged 2 commits intodevelopfrom
tolerate-null-values
Jul 25, 2025
Merged

[Query monitor] Tolerate null $value in boot.php#219
adamziel merged 2 commits intodevelopfrom
tolerate-null-values

Conversation

@adamziel
Copy link
Collaborator

PR #217 added a line global $wpdb to integration/query-monitor/boot.php which triggered this warning in WordPress Playground multisite tests:

+ <b>Warning</b>:  Attempt to read property "option_value" on null in <b>/internal/shared/sqlite-database-integration/integrations/query-monitor/boot.php</b> on line <b>80</b><br />

Removing either global $wpdb or guarding against a null $value solves the failure. I assume there's a reason for adding global $wpdb so, in this PR, I'm adding a guard against a null value.

@adamziel adamziel merged commit 1dc9eec into develop Jul 25, 2025
12 checks passed
@JanJakes JanJakes deleted the tolerate-null-values branch July 28, 2025 07:36
@JanJakes
Copy link
Member

Removing either global $wpdb or guarding against a null $value solves the failure. I assume there's a reason for adding global $wpdb so, in this PR, I'm adding a guard against a null value.

@adamziel I think the global $wpdb part is needed because I'm requiring the script from a function body (WP action). Removing global would cause $wpdb to always be null and thus an early return from the script.

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.

2 participants