mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@44166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3602,6 +3602,13 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
||||
$post_parent = 0;
|
||||
}
|
||||
|
||||
$new_postarr = array_merge(
|
||||
array(
|
||||
'ID' => $post_ID,
|
||||
),
|
||||
compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) )
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the post parent -- used to check for and prevent hierarchy loops.
|
||||
*
|
||||
@@ -3612,7 +3619,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
||||
* @param array $new_postarr Array of parsed post data.
|
||||
* @param array $postarr Array of sanitized, but otherwise unmodified post data.
|
||||
*/
|
||||
$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
|
||||
$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
|
||||
|
||||
/*
|
||||
* If the post is being untrashed and it has a desired slug stored in post meta,
|
||||
|
||||
Reference in New Issue
Block a user