[wp-trac] [WordPress Trac] #60314: Revisions: PHP Warning: Undefined array key 0 in .../wp-includes/meta.php on line 642
WordPress Trac
noreply at wordpress.org
Mon Jan 22 06:57:06 UTC 2024
#60314: Revisions: PHP Warning: Undefined array key 0 in .../wp-includes/meta.php
on line 642
--------------------------+-----------------------------
Reporter: picocodes | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Autosave | Version: 6.4.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
- Call register_post_meta() with single = true, type = object and
revisions_enabled = true.
- Save your meta value as an associative array.
- Next, call get_post_meta on a post that has a revision.
- The following filter will fire:
{{{#!php
<?PHP
add_filter( 'get_post_metadata', '_wp_preview_meta_filter', 10, 4 );
}}}
- Then return a single associative array.
- WordPress will treat this as multiple meta values and then try to
return the first index hence leading to the above notice.
If this is the intended behaviour then at least add a notice to the
register_post_meta function.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60314>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list