Make WordPress Core


Ignore:
Timestamp:
12/14/2018 05:12:12 AM (8 years ago)
Author:
desrosj
Message:

PHP7.3 compatibility: Fix compact throwing notices.

In PHP 7.3, the compact() function has been changed to issue an E_NOTICE level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

Props jorbin, desrosj.

Merges [43819] and [43832] to trunk.

Fixes #44416.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/post.php

    r44150 r44166  
    36033603        }
    36043604
     3605        $new_postarr = array_merge(
     3606                array(
     3607                        'ID' => $post_ID,
     3608                ),
     3609                compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) )
     3610        );
     3611
    36053612        /**
    36063613         * Filters the post parent -- used to check for and prevent hierarchy loops.
     
    36133620         * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
    36143621         */
    3615         $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
     3622        $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
    36163623
    36173624        /*
Note: See TracChangeset for help on using the changeset viewer.