From a6b3bced06abc025b1dd6055057f5d2b97c8321a Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 29 Jan 2014 06:46:12 +0000 Subject: [PATCH] `get_comment()`, `wp_get_post_revision()`, and `get_term()` all used to return by reference. Because of this, `$null` was set to `null` so the return value would be a variable where applicable. This has not been necessary since [21792], so the `$null`s have been removed. Props toszcze. Fixes #24768. Built from https://develop.svn.wordpress.org/trunk@27057 git-svn-id: http://core.svn.wordpress.org/trunk@26930 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 3 +-- wp-includes/revision.php | 3 +-- wp-includes/taxonomy.php | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index cd9c9e9b3e..16bd29ea1e 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -135,7 +135,6 @@ function get_approved_comments($post_id) { */ function get_comment(&$comment, $output = OBJECT) { global $wpdb; - $null = null; if ( empty($comment) ) { if ( isset($GLOBALS['comment']) ) @@ -151,7 +150,7 @@ function get_comment(&$comment, $output = OBJECT) { } elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) { $_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment)); if ( ! $_comment ) - return $null; + return null; wp_cache_add($_comment->comment_ID, $_comment, 'comment'); } } diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 82b95c31ec..12cc8e1c4f 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -256,11 +256,10 @@ function _wp_put_post_revision( $post = null, $autosave = false ) { * @return mixed Null if error or post object if success. */ function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') { - $null = null; if ( !$revision = get_post( $post, OBJECT, $filter ) ) return $revision; if ( 'revision' !== $revision->post_type ) - return $null; + return null; if ( $output == OBJECT ) { return $revision; diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 95c3d3676e..f5e3f22969 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -935,7 +935,6 @@ class WP_Tax_Query { */ function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') { global $wpdb; - $null = null; if ( empty($term) ) { $error = new WP_Error('invalid_term', __('Empty Term')); @@ -954,11 +953,11 @@ function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') { if ( is_object($term) ) $term = $term->term_id; if ( !$term = (int) $term ) - return $null; + return null; if ( ! $_term = wp_cache_get($term, $taxonomy) ) { $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %d LIMIT 1", $taxonomy, $term) ); if ( ! $_term ) - return $null; + return null; wp_cache_add($term, $_term, $taxonomy); } }