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:
Jonathan Desrosiers
2018-12-14 05:12:12 +00:00
parent 3011f8c8e7
commit 89d76b9884
8 changed files with 75 additions and 50 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'] ) ) {