#54453 closed defect (bug) (fixed)
Warning: Undefined array key 0 in /app/news/wp-includes/wp-db.php on line 1323
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.9 | Priority: | normal |
| Severity: | normal | Version: | 5.8.2 |
| Component: | Database | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When using $wpdb->prepare() without passing values to ...$args (i.e. preparing a query without bound values), a warning is issued by PHP >= 8.0:
Warning: Undefined array key 0 in /app/news/wp-includes/wp-db.php on line 1323
Reason: it's assumed that at least one value is bound to the query by passing method arguments besides the query string which is not necessarily the case.
The fix: just check if the array contains a value at index 0 before using it.
Attachments (1)
Change History (6)
This ticket was mentioned in PR #1900 on WordPress/wordpress-develop by mjaschen.
4 years ago
#1
- Keywords has-patch added
https://core.trac.wordpress.org/ticket/54453
Trac ticket:
#2
@
4 years ago
- Milestone changed from Awaiting Review to 5.9
Hi there, welcome to WordPress Trac!
Thanks for the ticket and the PR, this looks good to me.
#3
@
4 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 52206:
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
@SergeyBiryukov commented on PR #1900:
2 months ago
#5
Thanks for the PR! Merged in r52206.
Patch