Opened 7 months ago

Last modified 6 months ago

#22342 new enhancement

WP_DEBUG "undefined index" notices in get_metadata() for empty arrays

Reported by: doublesharp Owned by:
Priority: normal Milestone: Awaiting Review
Component: Warnings/Notices Version: 3.1
Severity: minor Keywords: has-patch needs-testing dev-feedback 2nd-opinion
Cc:

Description

When the WP_DEBUG constant is set, calling get_metadata() in /wp-includes/meta.php with $single==true can cause "undefined index" notices when the meta data value is an empty array. As null is an acceptable return value for this function, silencing the notice with @ will remove noise when debugging without the overhead of checking the array length or that the 0 index isset().

Attachments (2)

meta.php.patch (307 bytes) - added by doublesharp 7 months ago.
silences undefined index notice with @$check[0]
meta.php.2.patch (436 bytes) - added by doublesharp 7 months ago.
silences undefined index notice with @$check[0]

Download all attachments as: .zip

Change History (4)

silences undefined index notice with @$check[0]

  • Keywords dev-feedback 2nd-opinion added

silences undefined index notice with @$check[0]

  • Version changed from trunk to 3.1
Note: See TracTickets for help on using tickets.