`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:
parent
678ef2b1e1
commit
a6b3bced06
|
@ -135,7 +135,6 @@ function get_approved_comments($post_id) {
|
||||||
*/
|
*/
|
||||||
function get_comment(&$comment, $output = OBJECT) {
|
function get_comment(&$comment, $output = OBJECT) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$null = null;
|
|
||||||
|
|
||||||
if ( empty($comment) ) {
|
if ( empty($comment) ) {
|
||||||
if ( isset($GLOBALS['comment']) )
|
if ( isset($GLOBALS['comment']) )
|
||||||
|
@ -151,7 +150,7 @@ function get_comment(&$comment, $output = OBJECT) {
|
||||||
} elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) {
|
} elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) {
|
||||||
$_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment));
|
$_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment));
|
||||||
if ( ! $_comment )
|
if ( ! $_comment )
|
||||||
return $null;
|
return null;
|
||||||
wp_cache_add($_comment->comment_ID, $_comment, 'comment');
|
wp_cache_add($_comment->comment_ID, $_comment, 'comment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,11 +256,10 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
|
||||||
* @return mixed Null if error or post object if success.
|
* @return mixed Null if error or post object if success.
|
||||||
*/
|
*/
|
||||||
function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
|
function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
|
||||||
$null = null;
|
|
||||||
if ( !$revision = get_post( $post, OBJECT, $filter ) )
|
if ( !$revision = get_post( $post, OBJECT, $filter ) )
|
||||||
return $revision;
|
return $revision;
|
||||||
if ( 'revision' !== $revision->post_type )
|
if ( 'revision' !== $revision->post_type )
|
||||||
return $null;
|
return null;
|
||||||
|
|
||||||
if ( $output == OBJECT ) {
|
if ( $output == OBJECT ) {
|
||||||
return $revision;
|
return $revision;
|
||||||
|
|
|
@ -935,7 +935,6 @@ class WP_Tax_Query {
|
||||||
*/
|
*/
|
||||||
function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
|
function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$null = null;
|
|
||||||
|
|
||||||
if ( empty($term) ) {
|
if ( empty($term) ) {
|
||||||
$error = new WP_Error('invalid_term', __('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) )
|
if ( is_object($term) )
|
||||||
$term = $term->term_id;
|
$term = $term->term_id;
|
||||||
if ( !$term = (int) $term )
|
if ( !$term = (int) $term )
|
||||||
return $null;
|
return null;
|
||||||
if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
|
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) );
|
$_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 )
|
if ( ! $_term )
|
||||||
return $null;
|
return null;
|
||||||
wp_cache_add($term, $_term, $taxonomy);
|
wp_cache_add($term, $_term, $taxonomy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue