`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
This commit is contained in:
Scott Taylor 2014-01-29 06:46:12 +00:00
parent 678ef2b1e1
commit a6b3bced06
3 changed files with 4 additions and 7 deletions

View File

@ -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');
}
}

View File

@ -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;

View File

@ -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);
}
}