Make WordPress Core

Ticket #38082: 38082.0.diff

File 38082.0.diff, 1.4 KB (added by westonruter, 10 years ago)
  • src/wp-includes/meta.php

    diff --git src/wp-includes/meta.php src/wp-includes/meta.php
    index 8833d3e..887779c 100644
    function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {  
    463463                return false;
    464464        }
    465465
    466         $object_id = absint( $object_id );
     466        $object_id = intval( $object_id );
    467467        if ( ! $object_id ) {
    468468                return false;
    469469        }
    function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {  
    476476         * will effectively short-circuit the function.
    477477         *
    478478         * @since 3.1.0
     479         * @since 4.7.0 The $object_id may be negative when representing placeholder objects.
    479480         *
    480481         * @param null|array|string $value     The value get_metadata() should return - a single metadata value,
    481482         *                                     or an array of values.
    function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {  
    491492                        return $check;
    492493        }
    493494
     495        /*
     496         * A negative ID is used to represent a placeholder object. Since such an ID
     497         * could not exist in the DB where IDs are UNSIGNED INTEGERS then the function
     498         * must short circuit here. Meta for placeholder objects must be supplied
     499         * via the get_{$meta_type}_metadata filterl.
     500         *
     501         */
     502        if ( $object_id < 0 ) {
     503                return false;
     504        }
     505
    494506        $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
    495507
    496508        if ( !$meta_cache ) {