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.
Built from https://develop.svn.wordpress.org/trunk@44166


git-svn-id: http://core.svn.wordpress.org/trunk@43996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj
2018-12-14 05:13:52 +00:00
parent 8464097ea4
commit 268402cf53
7 changed files with 47 additions and 23 deletions

View File

@@ -3082,7 +3082,7 @@ function _close_comments_for_old_post( $open, $post_id ) {
*/
function wp_handle_comment_submission( $comment_data ) {
$comment_post_ID = $comment_parent = 0;
$comment_post_ID = $comment_parent = $user_ID = 0;
$comment_author = $comment_author_email = $comment_author_url = $comment_content = null;
if ( isset( $comment_data['comment_post_ID'] ) ) {